Synchronize Folders With Document Conversion Service
Recently we had a customer who was looking for a process that could convert all new files saved to a Master folder to a different file format, like TIFF or PNG – without them having to manually check the Master folder for new files to be converted. In other words, they needed an automated process to convert new files as they enter this folder, disregarding files that have already been converted.
The process of synchronizing the Master folder to what has already been converted can be accomplished using the Document Conversion Service’s Watch Folder and the DOS XCOPY command.
To look for any new files that have been added since the last conversion, we use the Watch Folder’s Completed folder (list of files that have been successfully converted) and use the XCOPY command to compare this folder to the Master folder. If there are new files, then those files are copied to the Watch Folder’s Input folder to be converted.
The workflow looks like this:
Technical Details on Configuring this Document Conversion Process
Here is how you configure Document Conversion Service and create a batch file to do the comparison and copying of new files.
Modify the Watch Folder configuration file:
- Stop Watch Folder Service. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Stop Watch Folder Service)
- Open Watch Folder configuration file. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Configure Watch Folder Settings)
- Change <add Name=”UseTimeDateSubFoldersInCompletedFolder …” to FALSE
- Make sure there is a path for the Completed folder (ie <add Name=”CompletedFolder” Value=”C:\PEERNET\Test\Completed”/> )
- Save the Watch Folder configuration file.
- Start the Watch Folder Service. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Start Watch Folder Service)
<WatchFolder Name="Folder Watch Local Drive"> <Settings> <!-- Folder options --> <add Name="InputFolder" Value="C:\PEERNET\Test\Input"/> <add Name="SearchFilter" Value="*.*"/> <add Name="IncludeSubFolders" Value="True"/> <add Name="DeleteInputSubFolders" Value="True"/> <add Name="StagingFolder" Value="C:\PEERNET\Test\Staging"/> <add Name="WorkingFolder" Value="C:\PEERNET\Test\Working"/> <add Name="FailedFolder" Value="C:\PEERNET\Test\Failed"/> <add Name="CompletedFolder" Value="C:\PEERNET\Test\Completed"/> <add Name="OutputFolder" Value="C:\PEERNET\Test\Output"/> <add Name="PollingInterval" Value="15000"/> <add Name="DCOMComputerName" Value="localhost"/> <add Name="TestMode" Value="false"/> <add Name="NormalizeFilenames" Value="false"/> <!-- 0 means no limit --> <add Name="Polling.MaxFilesToProcessAtATime" Value="0" /> <add Name="Polling.SynchronousFilePickup" Value="false" /> <add Name="UseTimeDateSubFoldersInCompletedFolder" Value="false" /> <add Name="UseTimeDateSubFoldersInFailedFolder" Value="true" />
Now we need a BAT file that does the comparison between the Master folder and the Completed folder to copy any new files from the Master folder to the Input folder, so they can be converted.
Create a file called Upload.bat and add these lines:
@echo off for /f %%a in ('xcopy "C:\Input\*.*" "C:\PEERNET\TEST\Completed" /L /Y') do ( if not exist "C:\PEERNET\Test\Completed.\%%~nxa" xcopy "%%a" "C:\PEERNET\Test\Input" /Y )
Edit Upload.bat to change:
- “C:\Input” to the Master folder where new files are saved
- “C:\PEERNET\Test\Completed” to the Completed folder in the Watch Folder configuration file
- “C:\PEERNET\Test\Input” to the Input folder in the Watch Folder configuration file
Then you can either manually run Upload.bat to copy any new files since the last conversion to the Input folder or you can set Upload.bat in a scheduled task that runs periodically, so that the checking is done automatically throughout the day.
If you have questions about the above configuration or if you need a custom document conversion solution of your own, see our list of software products for converting all kinds of document file types to TIFF, PDF, JPG and other image formats, or get in touch with one of representatives today.