General discussion

Locked

Purging Files X Days Old

By farazid ·
In NT script, is there an easy way of deleting files with specific extension created more than X days ago?

In UNIX, I execute the following script to delete files '.trc' type which are older than 14 days:

find $DDB -name '*.trc' -mtime +14 -exec rm {} \;


Thank you.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Purging Files X Days Old

by msamson In reply to Purging Files X Days Old

try using pkzip (in the command line format)
www.pkware.com/shareware/pkzip_cli.html

pkzip25 -add -move -bef 100600 -dir=root test.zip *.goo

With this, you create a zip file with all the .goo files (they've been moved from their current location to the zip file) that were created before 100600 (10/06/2000)
All you have to do then is to delete the .zip file and you're done!!

Hope this helps!

Martin.

Collapse -

Purging Files X Days Old

by farazid In reply to Purging Files X Days Old

This sloution must be placed in a .bat file so that it can be executed every day.
So, insted of 100600, I need something like (current_date - 14)

Is there such a thing?

Thank you!

Collapse -

Purging Files X Days Old

by msamson In reply to Purging Files X Days Old

Just use the %cur_date% variable if you're looking for todays' files...

pkzip25 -add -bef %cur_date% -dir=root *.goo

Collapse -

Purging Files X Days Old

by farazid In reply to Purging Files X Days Old

I do not want to delete today's files. I want to delete files 14 days old or older.

Thanks, Diana

Back to Windows Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums