To list all of the batch files on drive C:, type:
forfiles /p c:\ /s /m*.bat /c"cmd /c echo @file is a batch file"
To list all of the directories on drive C:, type:
forfiles /p c:\ /s /m*.* /c"cmd /c if @isdir==true echo @file is a
directory"
To list all of the files older than 100 days on drive C:, type:
forfiles /p c:\ /s /m*.* /dt-100 /c"cmd /c echo @file : date >= 100
days"
To list all of the files older than January 1, 1993 on drive C:, and then
display "file is quite old!" for files with a date older than 01/01/1993,
type:
forfiles /p c:\ /s /m*.* /dt-01011993 /c"cmd /c echo @file is quite
old!"
To list all of the extensions of all of files on drive C: in column format,
type:
forfiles /p c:\ /s /m*.* /c "cmd /c echo extension of @file is
0x09@ext0x09" With:
To list all of the batch files on drive C:, type:
forfiles /p c:\ /s /m *.bat /c "cmd /c echo @file is a batch file"
To list all of the directories on drive C:, type:
forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==true echo @file is a
directory"
To list all of the files older than 100 days on drive C:, type:
forfiles /p c:\ /s /m *.* /d t-100 /c "cmd /c echo @file : date >= 100
days"
To list all of the files older than January 1, 1993 on drive C:, and then
display "file is quite old!" for files with a date older than 01/01/1993,
type:
forfiles /p c:\ /s /m *.* /d t-01011993 /c "cmd /c echo @file is quite
old!"
To list all of the extensions of all of files on drive C: in column format,
type:
forfiles /p c:\ /s /m*.* /c "cmd /c echo extension of @file is
0x09@ext0x09"