[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] FileDir command line utility


Use FileDir utility to list or recursively process multiple files using date filters and other parameters

FileDir is similar to DOS dir command, except it can use file date filters as command line options as well as process each filtered file using command of your choice. FileDir supports both UNC and regular file masks and parameters.

Download FileDir.exe   (24 KB).

Here is the help screen containing complete description and examples

Usage: FileDir [/?] [/N] [/L symbol] [/C command] [/P parameters] [/D date] [/A days] [/B] [/F] [/Q] [/V] [/E exitcode] filemask

Command line parameters:

/? Print this help.
/N Output each file on a new line. This switch is opposite to /L switch. If /C switch is specified each file name is passed to the specified command as a command line argument.
     Example: FileDir /N /C "my_program.exe" *.*
If there are 3 files in the current directory then the following 3 commands will be executed:
     my_program.exe file1
     my_program.exe file2
     my_program.exe file3
If /C switch is not specified file names are simply printed to the standard output. This is the default behavior when only filemask is specified.
/L Output files as a symbol separated list. This switch is opposite to /N switch. If /C switch is specified file names are passed to the specified command as command line arguments. The separating symbol must be enclosed in double quotes.
     Example: FileDir /L "," /C "my_program.exe" *.*
If there are 3 files in the current directory then the following single command will be executed:
     my_program.exe file1,file2,file3
If /C switch is not specified file names are simply printed to the standard output as a symbol separated file list.
/C Execute the specified command either for each file or for all files as a group. See /N and /L switch descriptions for more info. The command text must be enclosed in double quotes.
     Example: FileDir /C notepad.exe /N *.txt
This will open every found .TXT file in the Windows Notepad.
/P Define additional parameters to be used with the command specified by /C switch. The parameters text must be enclosed in double quotes. Examples:
     FileDir /C "cmd" /P "/c del " /A 30 /N *.*
     FileDir /C "cmd" /P "/c del c:\temp\" /A 30 /N c:\temp\*.*
The first example will execute "cmd.com /c del {file}" command for every file in the current directory, whose age is older than 30 days. The second example will execute "cmd /c del c:/temp/{file}" command for every file in the c:/temp directory, whose age is older than 30 days.
/F Use full file names. If filemask refers to a relative path of has no path FileDir automatically expands file names to include full file path.
/Q Enclose file names in double quotes. Use this switch together with /C switch if file names include spaces.
/D Process files whose date is older or younger than the specified date. This switch must be followed by a date in mm/dd/yyyy format. See /O and /Y switch descriptions for more info. This switch is opposite to /A switch.
/A Process files whose age is older or younger than the specified number of days. This switch must be followed by a number. See /O and /Y switch descriptions for more info. This switch is opposite to /A switch.
/O Process "older" files. This is the default setting for /A and /D switches. See /D and /A switch descriptions for more info.
/Y Process "younger" files. See /D and /A switch descriptions for more info.
/S Process subdirectories recursively.
/B Suppress banner printing.
/E Wait for the shelled process to complete and grab process exit code. This switch can be used together with /C switch. Abort file processing if the returned exit code does not equal the specified "exitcode" value.
/V Set verify flag. If this flag is set every executed command is printed to the standard output. Additional diagnostic messages might be also printed depending on other switches and processing options.
filemask The file mask to be used for the file search. Example: *.txt.

Run FileDir.exe without parameters from the DOS command prompt to see full description of the supported parameters.