Historically, Windows (and before that, DOS) had a maximum path length (MAXPATH) of 260 characters. While this has changed over the years to allow file paths of up to 32,000 characters, many of the underlying components of Windows are still bound by the MAXPATH limitation.

Most of the time you never have to think about long path support but it does occasionally occur. A common situation would be having to convert all the files in a directory structure on network attached storage (NAS) created in UNIX or another file system where long paths are supported.

To handle this, Document Conversion Service and the Watch Folder Service support long path names for the input, output, failed and completed folders of a watch folder, as well as saving the results XML files and logging files.

The one caveat is that the files and directory structures copied to the staging and working folders to be processed need to be less than 255 characters. We can do this by keeping these paths as short as possible. This staging and working folder limitation is a requirement of the underlying programs, such as Adobe Reader and Microsoft Office, that Document Conversion Service uses to perform conversions. If the file path sent to Document Conversion Service to be converted is longer than MAXPATH that file will gracefully fail to convert.

Keep in mind that even if the input folder path itself is not greater than MAXPATH, the underlying subfolders and file names can create a path that is. You can see by this sample directory shown below that using C:\ALongPathTestFolder as the input folder path will generate file paths longer than MAXPATH.

 

In this scenario, you can also set UseCompressedDateTimeFormat option to true to use a shorter version of the date-time stamp named subfolder in the working, staging, completed and failed folders. The default creates an easier to read folder name similar to Thursday_March_31_2016_10_16_32_AM, while the condensed date-time stamp is strictly numerical and similar to 20160331131645.

A sample WatchFolder configuration is shown below.

 

Code Sample

 
<!-- This watch folder creates 300 DPI Optimized TIFF Images -->
<WatchFolder Name="ConvertToTIFF Watch Folder">
  <Settings>
    <!-- Folder options -->
    <add Name="Enabled" Value="true" />
    <add Name="InputFolder" Value="C:\ALongPathToTestFolder\"/>
    <add Name="SearchFilter" Value="*.*"/>
    <add Name="IncludeSubFolders" Value="True"/>
    <add Name="DeleteInputSubFolders" Value="True"/>
    <add Name="StagingFolder" Value="C:\PN\S"/>
    <add Name="WorkingFolder" Value="C:\PN\W"/>
    <add Name="FailedFolder" Value="C:\ALongPathToTestFolderResults\Failed"/>
    <add Name="CompletedFolder" Value="C:\ALongPathToTestFolderResults\Completed"/>
    <add Name="OutputFolder" Value="C:\ALongPathToTestFolderResults\Output"/>
    <add Name="PollingInterval" Value="15000"/>
    <add Name="DCOMComputerName" Value="localhost"/>
    <add Name="TestMode" Value="false"/>
    <add Name="NormalizeFilenames" Value="false"/>
    <add Name="CopyInstructionsFromResources" Value="ReadMe_ConvertToTIFF"/>
 
    <!-- 0 means no limit -->
    <add Name="Polling.MaxFilesToProcessAtATime" Value="0" />
    <add Name="Polling.SynchronousFilePickup" Value="false" />
 
    <add Name="UseTimeDateSubFoldersInCompletedFolder" Value="true" />
    <add Name="UseTimeDateSubFoldersInFailedFolder" Value="true" />
    <add Name="UseCompressedDateTimeFormat" Value="true" />
 
    <!-- Output file options -->
    <add Name="Devmode settings;Resolution" Value="300"/>
 
    <add Name="Save;Output File Format" Value="TIFF Multipaged"/>
    <!-- Replace the above with this to create serialized images. -->
    <!-- <add Name="Save;Output File Format" Value="TIFF Serialized"/> -->
 
    <add Name="Save;Append" Value="0"/>
    <add Name="Save;Color reduction" Value="Optimal"/>
    <add Name="Save;Dithering method" Value="Halftone"/>
 
    <!-- This creates file.ext.tif, change to 1 to create file.tif-->
    <add Name="Save;Remove filename extension" Value="0" />
 
    <add Name="TIFF File Format;BW compression" Value="Group4"/>
    <add Name="TIFF File Format;Color compression" Value="LZW RGB"/>
    <add Name="TIFF File Format;Indexed compression" Value="LZW"/>
    <add Name="TIFF File Format;Greyscale compression" Value="LZW"/>
    <add Name="JPEG File Format;Color compression" Value="Medium Quality"/>
    <add Name="JPEG File Format;Greyscale compression" Value="High Quality"/>
  </Settings>
</WatchFolder>