cancel
Showing results for 
Search instead for 
Did you mean: 

File whitelisting / blacklisting with ndrive

hgret_
Champ in-the-making
Champ in-the-making

Hi,

I know that the nuxeo sync client ndrive is a relatively new thing. Is there a possibillity to limit the file types thet are synced from the folder? So that I can keep e.g. the pdf's in the same folder as the Office documents but only the Office documents are synced. Would be also useful to keep raw and jpeg images in the same folder but only sync the smaller jpgs.

Is there any type of file sync filtering?

Thanks in advance.

3 REPLIES 3

ataillefer_
Star Contributor
Star Contributor

Hi,

Server-side you can override the defaultFileSystemItemFactory contribution to the fileSystemItemFactory extension point with a Java class extending DefaultFileSystemItemFactory and overriding isFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint).

By default we only check if the document is folderish or holds a blob. You could add a filter on the mime-type to return false (meaning the file won't be synchronized) in the case of a .pdf file for example.

// Check Folderish or BlobHolder with a blob
if (!doc.isFolder() && !hasBlob(doc)) {
   log.debug(String.format(
       "Document %s is not Folderish nor a BlobHolder with a blob, it cannot be adapted as a FileSystemItem.", doc.getId()));
    return false;
}

Client-side, unfortunately for now the blacklisted extensions are hardcoded in nuxeo-drive-client/nxdrive/client/common.py:

DEFAULT_IGNORED_SUFFIXES = [
    '~',  # editor buffers
    '.swp',  # vim swap files
    '.lock',  # some process use file locks
    '.LOCK',  # other locks
    '.part',  # partially downloaded files
]

So if you want to always blacklist .pdf files for example you will need to add this extension to the ignored suffixes and build the client, see contributor guide for instructions.

We are planning to allow customization of the file suffixes to ignore in a local configuration file, see related JIRA issue NXP-13219.

Hope this helps.

hgret_
Champ in-the-making
Champ in-the-making

Hi,

Yes blacklisting only client-side.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.