A command line utility to search a folder, and optionally any subfolders and return a list of files matching the search filter specified. The information extracted is sent to standard out.

DCSCreateFileList [/R] [F=filter]

                  [/NAME=sort files by name] [/CREATED=sort files by creation date]

                  [/MODIFIED=sort files by name]

                  [/DESC=sort files in descending order (Z-A, 9-0)]

                  searchfolder

 

This utility can be used to search folders for files to send to the command line utilities, or to find the the results log files created by any of command line utilities. The folder search is optimized for speed and efficiency and will return all files that match the filter provided.

Hidden and system files are ignored, and the search pattern filters files based on a regular expression match of the long name of a file. This is different from the Microsoft .Net System.IO.Directory.GetFiles method which returns files based on a check against file names with both the 8.3 file name format and the long file name format, which can cause unexpected file names to be returned.

The file list returned can optionally be sorted by name, date created or date modified. Results are always in ascending order (0-9, A-Z). Pass /DESC to return the results in descending (9-0, Z-A) order.

Sample Command Lines

Searching a folder based on a single file type:

DCSCreateFileList /F="*.tif" "C:\Test\Output"

DCSCreateFileList /R /F="*.tif" "C:\Test\Output"

Searches the folder C:\Test\Output for all files ending in the pattern .tif. Only files with the three letter extension .tif will be returned.

The second example will recursively search the folder C:\Test\Output and all subfolders for all files ending on .tif.

 

Search a folder for more than one file type, sort by name:

DCSCreateFileList /R /F="*.doc|*.pdf" /NAME "C:\Test\Input"

DCSCreateFileList /R /F="*.doc|*.pdf" /NAME "C:\Test\Input" > C:\Test\InputFileList.txt

To search for more than one file type, separate the filter patterns using the pipe (|) character.

This example recursively searches the folder C:\Test\Input for all files ending in the .doc or .pdf extension. The complete path to all files with only the three letter extension .doc and .pdf will be returned and sent to the console through standard output.

The second command line shown uses the redirection operator > to redirect the console's standard output into a text file located at C:\Test\InputFileList.txt.

 

Search the folder C:\Test\Output for all succeeded result log files:

DCSCreateFileList /F="*.succeeded.dcsresults" "C:\Test\Output"

DCSCreateFileList /R /F="*.succeeded.dcsresults" "C:\Test\Output" > "C:\Test\CompletedResults.txt"

Searches the folder C:\Test\Output for all results log files that represent completed conversions. The full path to each matching file found is sent to the console through standard output.

The second example does the same as the first except that it recursively searches the folder C:\Test\Output and any subfolders for all results log files that represent completed conversions, not just the root folder. It also uses the redirection operator > to redirect the output into a text file located at C:\Test\CompletedResults.txt.

 

Search the folder C:\Test\Output for all failed results log files:

DCSCreateFileList /F="*.failed.dcsresults" "C:\Test\Output"

DCSCreateFileList /R /F="*.failed.dcsresults" "C:\Test\Output" > "C:\Test\FailedResults.txt"

Searches the folder C:\Test\Output for all results log files that represent failed conversions. The full path to each matching file found is sent to the console through standard output.

The second example does the same as the first except that it recursively searches the folder C:\Test\Output and any subfolders for all results log files that represent failed conversions, not just the root folder. It also uses the redirection operator > to redirect the output into a text file located at C:\Test\FailedResults.txt.

 

Command Line Arguments

Command line switches are not case-sensitive and can be entered in either upper or lower case.

/R - Include Subfolders (Recurse)

If this switch is used, the subfolders under the folder are included when searching for the list of files that match the filter pattern.

 

/F - File Filter

Defines the filter that determines what files can be returned, such as using *.pdf to only process PDF files. When this switch is not specified all files (*.*) in the folder are will be returned. Hidden and system files are ignored, and the search pattern filters files based on a regular expression match of the long name of a file.

Multiple filters are combined using the pipe (|) character, such as *.doc|*.pdf to process only Word and PDF files.

 

/NAME - Sort Files by Name

The file list picked up from the folder is sorted by file name in ascending order (0-9, A-Z).

 

/CREATED - Sort Files by Creation Date

The file list picked up from the folder is sorted by the files creation date file name in ascending order (0-9, A-Z).

 

/MODIFIED - Sort Files by Modified Date

The file list picked up from the folder is sorted by the files last modifed date file name in ascending order (0-9, A-Z).

 

/DESC - Sort Files in Descending Order

Use with /NAME, /CREATED or /MODIFIED. Sorts the descending order (Z-A, 9-0).

 

searchfolder

The full path to the folder in which to start searching.

 

/? - Display Help

When passed as the only argument this switch will display help for this command.