Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Processing - deleting old files 1

Status
Not open for further replies.

inunix

Technical User
Jul 30, 2002
53
0
0
US
Hi

Can anyone provide a batch(DOS) file to delete files older than certain number of days.

1. One for files start with some pattern
2. All files in a folder and its subfolder.

Thanks.


 
Hi Xaqte, Will try this and let you know.

Thanks for your help.
 
Hello inunix,

This is what I had answered in another thread616-889024.
[tt]
You can use forfiles.exe from resource kits. Look at its help file or issue
forfiles -?
for syntax.

For instance, to [1] delete *.txt files [2] in certain path d:\test [3] including subdirectories for files [4] with date more than 30 days old from today, the line in the batch is something like this:

forfiles -pd:\test -s -m*.txt -d-30 -c"%comspec% /c del @FILE"
[/tt]
regards - tsuji
 
Thanks all for your reply.

Hello tsuji, can you give some insight abt forfiles.. I couldn't find in my computer..

I'm not aware of resource kits..

Pls provide more details in this regard.

Thanks
 
Thanks tsuji. We do have both NT and 2000 servers. Will the latest version of forfiles.exe can be used against these servers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top