The following is an overview of how the Watch Folder Service works.

For each folder watched, the service uses the following:

an enabled flag that determines if the folder will be monitored or not

an input folder to collect the files to be converted based on a search pattern and optional sub-directory inclusion

a staging folder to hold the files being processed

a working folder that holds the output files during creation

an output folder, which is the final destination of the created files; they are copied into this folder when conversion is complete

a failed folder that contains a copy of any file which failed to be converted

an optional completed folder to hold a copy of all input files that have been processed

options to control the number of files picked up at a time and if batches are run synchronously

options to extract and process attachments from Outlook MSG archive files

how files are stored in the completed and failed folders

 

The input folders are polled on a customizable time interval looking for files or folders to convert. If any files or folders of files are dropped into the input folder that meet the criteria of what files you want to convert, these files, or the number of files allowed, are moved into a uniquely named folder (based on date and time) under the staging folder.

When a folder is dropped into the input location, it searches for files that match the criteria. If any matching files are found in the folder, the folder's structure is mirrored under the new folder in the staging location and the files copied for conversion. During all subsequent steps of copying to the output folder, failed folder or completed folder the folder's structure is kept intact.

Once under the staging folder, the files are passed to Document Conversion Service to be converted using the output format settings provided for that watch folder. Putting files in this staging folder prevents file name collisions if another file of the same name is dropped into the folder by another user.

Converted files are stored first in the working folder while they are being created. Once complete, they are copied into the output folder. If any file should fail to convert a folder under the failed folder (using the same date and time stamped folder name as was created under the staging folder) is created and the failed file is copied there.

If the completed folder is specified, all source files are copied to a new folder (using the same date and time stamped folder name as was created under the staging folder) under the completed folder.  If the completed folder is not specified, the source files are deleted.

If you do not want your completed and failed files copied into subfolders under their respective folders, this behavior can be disabled to copy the files directly into the folders provided without creating the subfolder. Take note that with this behavior existing files with the same name will be overwritten.

The sample uses the file extension of the file chosen to determine what converters PNDocConvQueueServiceLib will try and use when converting the files.

You can provide a single converter name or a semi-colon separated list of converter names to use. If you pass a list of names the first matching converter name that has a running converter in Document Conversion Service will be used. See What Files Can I Convert? for a list of converter names to use.