Re: Delete folder based on date
From: Olaf Engelke [MVP] (oenews01_at_mvps.org)
Date: 11/08/04
- Next message: Gerry Hickman: "Re: Need testers for printer management tool"
- Previous message: Erin0: "All users password expiration date"
- In reply to: dte: "Delete folder based on date"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Nov 2004 21:49:12 +0100
Hi,
dte wrote:
> Hello,
> I am looking for a script that will scan a folder and delete and
> subfolder that is older than 2 days. I want this to run everynight
> to clean up the folder..
> I have a script to delete files in a folder that are older than 2
> days.. but it will not work on the folders.
there is a tool on the Windows 2003 server called forfiles.
This you could use to create that script.
forfiles.exe –p C:\Logfiles –m *.* -d-2 –c "cmd /c del @FILE"
This example would do that task for files.
Another way would be to use the ability of xcopy to copy files by date to
another temporary folder, clean out the entire source folder, copy the saved
files back and wipe the temporary folder.
(Problem in this solution is to determine the current date -2 days as
required xcopy parameter automatically, if you dont run that clean up job
manually each day.)
Best greetings from Germany
Olaf.
- Next message: Gerry Hickman: "Re: Need testers for printer management tool"
- Previous message: Erin0: "All users password expiration date"
- In reply to: dte: "Delete folder based on date"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|