Skip navigation

JSI Tip 1874. The Resource Kit ForFiles command.

ForFiles is a command-line tool for selecting files for batch processing.

ForFiles enables you to run a command on/pass arguments to multiple files. It is simpler to use than the FOR command.

The syntax is:

ForFiles \[-ppath\] \[-msearchmask\] \[-ccommand\] \[-dddmmyy\] \[-s\] \[-v\] \[-?\]

Where:

-ppath is the path to start searching.
-msearchmask is the seach mask, where *.* is the default.
-ccommand is a command to execute on each file. the default command is "cmd /c echo @file". Other variables are @path and @relpath
-dddmmyy Files with a date >= ddmmyy are selected.
-s Sub-directories are processed.
-v Verbose output is selected.
? Help.

Example:

ForFiles -pc:\ -s -m*.bat -c"cmd /c echo @file is a batch file"

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish