forfiles – run commands for each file in a location

forfiles allows command line users to run commands for each file in a location. Some of the tasks that the forfiles command can be used to do are deleting old files and renaming files. It a native command in Vista or newer. For WinXP you can find it in the Recource Kit.

Example:

forfiles -p "E:\VideoArchiv" -s -m *.asf -d -01.01.2014 -c "cmd /c echo @path >> E:\del.txt"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.