benzzon.se
Published on benzzon.se (http://www.benzzon.se)

Home > BAT: Delete old files, "forfiles"..

1 post / 0 new
Log in [1] to post comments
Tue, 04/29/2008 - 16:37
#1 [2]
benzzon
benzzon's picture
BAT: Delete old files, "forfiles"..
 

ForFiles - Delete files older than 30 Days

FORFILES /P C:\MyPath\ /S /M log*.txt /D -30 /C “cmd /c del @file”

/S - look at subdirectories
log*.xml - that is the file pattern, you could have it be like *.txt for example
/D -30 = files greater than 30 days
/C - thats the command you want to run

*** Make sure to save batch-file as "DOS-text"..

Download (rename to .exe): forfiles [3]
 
http://winhlp.com/node/180 [4]
 
Top

Source URL: http://www.benzzon.se/?q=node/102

Links
[1] http://www.benzzon.se/?q=user/login&destination=node/102%23comment-form
[2] http://www.benzzon.se/?q=node/102
[3] http://www.benzzon.se/bin/forfiles.zzz
[4] http://winhlp.com/node/180