| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
write a script to delete files 7 da
|
Original Message
|
Name: rpr986
Date: October 7, 2008 at 12:35:43 Pacific
Subject: write a script to delete files 7 daOS: WIN server 2003CPU/Ram: ???Manufacturer/Model: ???? |
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??? if you cant tell i am a newb
Report Offensive Message For Removal
|
|
Response Number 1
|
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
Report Offensive Follow Up For Removal
|
|
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
Report Offensive Follow Up For Removal
|
|
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
Report Offensive Follow Up For Removal
|
|
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...
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Windows Server 2003 Forum Home
Results for: write a script to delete files 7 da
Script to share and unshare a file 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 ...
www.computing.net/answers/windows-2003/script-to-share-and-unshare-a-file/5734.html
script to report file types 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. ...
www.computing.net/answers/windows-2003/script-to-report-file-types/7731.html
unable to delete files 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...
www.computing.net/answers/windows-2003/unable-to-delete-files/7364.html