Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
write a script to delete files 7 da
Name: rpr986 Date: October 7, 2008 at 12:35:43 Pacific OS: WIN server 2003 CPU/Ram: ??? Product: ????
Comment:
I need to write a script that will delete files that are 7 days old, and i need this script to run once every 24 hours. Where should i start???
Name: amlife Date: October 8, 2008 at 07:43:22 Pacific
Reply:
well you can write script and schedule it to run every 7 days on directory and it will delete your "7" days old files.
batch files can help you with such task in windows environment.
and you can schedule it with windows task scheduler.
can you tell us the location of the files you want to remove and what type of files?
Thanks
0
Response Number 2
Name: rpr986 Date: October 9, 2008 at 05:55:54 Pacific
Reply:
Just say the directory is D:\ftp
The files are normally word documents and sometimes excel sheets. I guess that really doesnt matter, just anything older than 7 days needs to be deleted...
thanks
0
Response Number 3
Name: KReagan Date: November 3, 2008 at 21:18:16 Pacific
Reply:
You will need a copy of Microsofts robocopy installed and c:\deleted should not exist.
Schedule this to run in task scheduler every 24 hours, it is one single command line
cmd.exe /c for /f "tokens=3,4*" %I in ('robocopy d:\ftp c:\deleted *.bat *.txt /s /minage:7 /L /FP ^| find /i "new file"') do del %J
0
Response Number 4
Name: KReagan Date: November 3, 2008 at 22:30:52 Pacific
Reply:
How about forfiles /p d:\ftp /m *.* /d -y /s /c "cmd /c del @path"
0
Response Number 5
Name: KReagan Date: November 3, 2008 at 22:33:54 Pacific
Reply:
sorry, syntac error, should be forfiles /p d:\ftp /m *.* /d -7 /s /c "cmd /c del @path"
0
Response Number 6
Name: rpr986 Date: November 4, 2008 at 05:24:33 Pacific
Reply:
What will happen to the folder if all the files in it are gone? What will happen if the folder is older than 7 days but the files are newer than 7 days?
The script was good, but then i came up with these issues...
Summary: Hello everyone, my situation is as follows. I have an updating program to update a file every night. That file is in local harddisk, but is shared to the network users. I would like to write a script ...
Summary: Hey fellas, I need some help scripting out a report to aggregate *.mdb's over one of our file shares. I would like to report last modify date and location. Thanks for the help guys. ...
Summary: I have the same problem with some PDF's as well. We are able to open the file, and if I take ownership of the file I still can't delete because of the message; "can not delete file is in use by other...