# Script to delete files () days old



## antmar904 (Feb 22, 2010)

Hi All,

When ever a user logs into a pc on our domain it creaets a log file on one of our file servers 
ext: \\file4\files

I would like to run a schedual task on that server EVERY DAY that deletes any files older than (7) days of the current date.

Can anyone help with this, i prefure to use a batch file but vbs is welcome also!


----------



## Squashman (Apr 4, 2003)

The ForFiles command is the perfect solution for this.
http://forums.techguy.org/all-other-software/900984-how-delete-files-folders-if.html
http://blog.stevienova.com/2007/02/27/forfiles-delete-files-older-than-x-amount-of-days/


----------



## LauraMJ (Mar 18, 2004)

Re-opening thread as requested.


----------

