How do I import assets automatically from the filesystem?

Note: In older versions of Asset Bank 'folders' were called 'access levels'

Asset Bank supports the concept of 'watched directories'. Using this functionality you can specify one or more directories on the file system from which asset files will be automatically ingested.

Enabling Watch Directories

Edit the application settings file to change these settings:

watch-directory-period-millis: set this to the period for which Asset Bank will wait before checking the watch directories. 60000 is 1 minute, which is reasonable.

watch-directory-auto-add: usually you will want to set this to true. (If false the directories will still be watched but the presence of new files will just result in an alert email being sent to admin users)

watch-directory-submit-for-approval: set thisto true if you you want assets created from 'watched files' to be submitted for approval. If false then these assets will go 'live' without needing approval.

watch-directory-replace-if-same-filename: if false then a new asset will be created for every 'watched' file. If true then, when adding a file that has just been picked up from the 'watch' directory, Asset Bank will first search for an asset with the same filename. If it finds one then this asset will be updated, rather than a new asset created.

Adding a Watch Directory

First, make sure that application setting watch-directory-count is set for the number of watched directories you require. By default this is set to 1.

The second step is to enter the directories in settings watch-directory, watch-directory2, watch-directory3 etc. depending on how many you need. The directory path should start with a slash. For example, to set up the second watch directory called 'images' in the root of the server, the setting would be: watch-directory2=/images

If you have asset types enabled (asset-entities-enabled=true) then you need to use at least version 3.980 of Asset Bank and set the asset type for each directory with watch-directory-asset-entity-id, watch-directory-asset-entity-id2, watch-directory-asset-entity-id3 etc.

You can tell Asset Bank how often it should check for new files using application setting watch-directory-period-millis which takes a value in milliseconds. For example, to get Asset Bank to scan the watched directories every hour, set this setting to 3600000.

Asset Bank will search recursively through directories and sub-directories to find files to ingest unless the files were put in there less than 5 minutes ago (basically Asset Bank always waits for 5 minutes when a user has added files to an ingest directory before trying to ingest them) The files will then be ingested unless they are located in a directory called _process_ in which case Asset Bank will not process the directory. Files that fail to get ingested will be moved into the bulk-upload-processed directory.

Assigning folders

When assets are added using this method, you may not want them to be accessible straight away, and/or may want to group them so that they are easy to find. You can do this by specifying one or more folders to be automatically assigned to assets loaded from each watched directory. This is done with settings watch-directory-access-levels, watch-directory-access-levels2, watch-directory-access-levels3, etc. where the value for each is a comma-separated list of folder ids (e.g. watch-directory-access-levels2=1,8,9).

Mapping Subdirectories to Categories/folders

The directory structure within the watch directory can be mapped to the category structure in Asset Bank. Assets placed in subdirectories can automatically be assigned to the corresponding category and the category will be created if necessary. This functionality can be enabled by setting map-watch-subdirectories-to-categories=true.
Alternatively, this can be used to instead map the directory structure to folders setting map-watch-subdirectories-to-access-levels=true.
Note: These settings cannot both be set to true.


Was this article helpful?

Yes No

Thanks for your feedback!