ForFiles Main Topic | Next
ForFiles Syntax
forfiles [-ppath] [-msearchmask] [-ccommand] [-d{+|-}{ddmmyyyy|dd}] [-s] [-v] [-?]
Where:
- -ppath
- indicates a path on which to start searching. The default folder is the current one from which forfiles is run (.).
- -msearchmask
- searches files according to searchmask. The default searchmask is *.*
- -ccommand
- indicates a command to execute on each file. Command strings with spaces must be enclosed in double quotation marks. The default command is "cmd /c echo @file".
The following variables can be used in a command string: @file, @file_without_ext, @ext, @path, @relpath, @isdir, @fsize, @fdate, @ftime.
To include special characters in the command line, use the hexadecimal code 0xHH.
- -d{+|-}{ddmmyyyy|dd}
- selects files with a date greater than or equal to (>=), or less than or equal to (<=), ddmmyyyy (UTC), or files with a date greater than or equal to (>=), or less than or equal to (<=), the current date minus dd days.
- -s
- instructs forfiles to recurse into subdirectories.
- -v
- runs forfiles in verbose mode.
- -?
- displays this usage screen. Usage can also be displayed by running forfiles without arguments.