ForFiles Main Topic | Previous
The defaults for ForFiles arguments are:
Directory: . (current directory)
Search Mask: *.*
Command: "cmd /c echo @file"
To list all the batch files on drive c:
forfiles -pc:\ -s -m*.bat -c"cmd /c echo @file is a batch file"
To list all the directories on drive c:
forfiles -pc:\ -s -m*.* -c"cmd /c if @isdir==true echo @file is a directory"
To list all the files older than 100 days on drive c:
forfiles -pc:\ -s -m*.* -d-100 -c"cmd /c echo @file : date >= 100 days"
To list all the files older than January 1, 1993 on drive c:
forfiles -pc:\ -s -m*.* -d-01011993 -c"cmd /c echo @file is quite old!"
To list all the extensions of all files on drive c:
forfiles -pc:\ -s -m*.* -c"cmd /c echo extension of @file is 0x22@ext0x22"