Batch Files Again
Author
Discussion

fish

Original Poster:

4,061 posts

306 months

Thursday 26th August 2004
quotequote all
Anyone know the command lines to delete all files in a directory which have not been modified for x days.

I need to be able to run a script which just automatically cleans up certain folders.

Any thoughts

Liszt

4,334 posts

294 months

Thursday 26th August 2004
quotequote all
format c: /s

Podie

46,649 posts

299 months

Thursday 26th August 2004
quotequote all
Liszt said:
format c: /s





Probably easier in VBScript...

plotloss

67,280 posts

294 months

Thursday 26th August 2004
quotequote all
MUCH easier in vbScript.

GregE240

10,857 posts

291 months

Thursday 26th August 2004
quotequote all
Do you know what the folders are called?

I've done this before without using VB Script (because I can), simply blat everything and recreate the folder structure from scratch.

fish

Original Poster:

4,061 posts

306 months

Thursday 26th August 2004
quotequote all
Yep but I was just after the script so if for example the folder is c:updateemail then What would the script be ie:

delete c:updateemail /older than 30 days

????????

plotloss

67,280 posts

294 months

Thursday 26th August 2004
quotequote all
Its not at all simple in batch.

The Del command doesnt have a parameter for age.

You have to ascertain the update date of the file and then parse it to compare against today.

There are plenty of examples on Google though.

fish

Original Poster:

4,061 posts

306 months

Thursday 26th August 2004
quotequote all
cheers