I'm looking for a function in batch that recursive delets all files/folders older than X Days from a given path.

Is there a Fast and easy snippet that could be placed in a batch function?

link|improve this question
1  
possibly duplicate stackoverflow.com/questions/51054/… – Siva Charan Feb 10 at 16:52
also: serverfault.com/questions/49614/delete-files-older-than-x-days (maybe we need one of those on SU as well...) – Oliver Salzburg Feb 10 at 17:04
hmm on serverfault these are not really batch. stackoverflow are nor running for me atm. but I need to figure out the problem ... – VZn Feb 20 at 1:20
feedback

1 Answer

If your command interpreter is JP Software's TCC/LE, simply use date ranges and the del command. Here's how to delete files (and consequent empty directories) older than 30 days:

del /[d-30,%@makedate[0]] /s/x *
The * is a wildcard, of course, and can include a pathname.

Further reading

link|improve this answer
I can only use the standard Windows batch interpreter. – VZn Feb 13 at 2:12
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.