Operation Step Address: Http://wenku.baidu.com/link?url=_ Ddt7kztamwfc4ru1hms2tofb0p8us-wsxzqmccdt4k8-dp6vzcygz5mmu-rdms76efimpmgl9f0wqwd2s8uvux1u8_hkjkxdbcb4ikknum
Delete files from three days ago
forfiles/p i:\serverbak\2005/s/M * */d-2/"cmd/c del @file"
Description: Forfiles is 2003 of the command, very useful, detailed can forfiles/? Can be copied to XP for use, and the test failed to replicate to 2000.
Forfiles:
The path specified by/p
/s includes sub-directories
/M Lookup filename Mask
/d Specifies the date, with an absolute date and a relative date, where-7 refers to the current date 7 days ago
The command line run by/C represents the command executed for each file. The command string should
Enclose in double quotation marks.
The default command is "cmd/c echo @file". The following variables
Can be used in the command string:
@file-Returns the file name.
@fname-Returns the file name without an extension.
@ext-returns only the extension of the file.
@path-Returns the full path of the file.
@relpath-Returns the relative path of the file.
@isdir-Returns "TRUE" if the file type is a directory;
If it is a file, return "FALSE".
@fsize-Returns the file size in bytes.
@fdate-Returns the date the file was last modified.
@ftime-Returns the time the file was last modified.
Example to list all 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 directories on drive C:, type:
forfiles/p C =/s/m*.*/C "cmd/c if @isdir ==true echo @file is a directory"
To list all files on drive C: With more than 100 days of existence, type:
forfiles/p c \/s/m*.*/dt-100/c "cmd/c echo @file:d ate >=
To list drive C: All files that were created before January 1, 1993, and for files that have dates earlier than January 1, 1993 that show "file is quite old!", type:
forfiles/p c \/s/m*.*/dt-01011993/c "cmd/c Echo @file is quite old!"
To list the extensions for all files on drive C: In column format, type:
forfiles/p \/s/m*.*/C "cmd/c echo extension of @file is [email protected]" with:
To list all 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 directories on drive C:, type:
forfiles/p C =/s/m */"cmd/c if @isdir ==true echo @file is a directory"
To list all files on drive C: With more than 100 days of existence, type:
forfiles/p c \/s/m */d t-100/c "cmd/c echo @file:d ate >=
To list drive C: All files that were created before January 1, 1993, and for files that have dates earlier than January 1, 1993 that show "file is quite old!", type:
forfiles/p c \/s/m */d t-01011993/c "cmd/c Echo @file is quite old!"
To list the extensions for all files on drive C: In column format, type:
forfiles/p c \/s/m*.*/C "cmd/c echo extension of @file is [email protected]"
Windows automatically deletes files at timed intervals