Re: Delete folder based on date

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Olaf Engelke [MVP] (oenews01_at_mvps.org)
Date: 11/08/04


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.



Relevant Pages

  • Re: User account and Personal folder mismatch script
    ... I believe you want a script that can be run by an administrator that will ... The script above only documents if a home folder has been assigned. ... > End Sub ...
    (microsoft.public.scripting.vbscript)
  • Input on CleanUp script
    ... Since I'm going to be using this script in a production environment, ... If the script is used with a backup folder ... var strTargetFolder, strBackupFolder, args0, args1, args2, noArgs; ...
    (microsoft.public.scripting.wsh)
  • Input on CleanUp script
    ... Since I'm going to be using this script in a production environment, ... If the script is used with a backup folder ... var strTargetFolder, strBackupFolder, args0, args1, args2, noArgs; ...
    (microsoft.public.scripting.jscript)
  • Re: Disappearing Links
    ... I believe someone has a script for rebuilding links but I'm unable to find it at the moment. ... It could be adapted to trawl through the whole mail folder tree - if you really need that, ... -- to any contacts in the address book that match the sender of the messages ... set theSelection to selection ...
    (microsoft.public.mac.office.entourage)
  • Re: OT:macros or software?
    ... when a .PDF file is stored there, ... words and depending on weather those words are found in that document, move it to a predetermined folder. ... Easy enough if it were a text document, or even Word, as you could write a DOS script, or a VBS script if you had to load Word to read Word documents, although writing such a script can be harder to a beginner than some might think. ... OK the goal is to put the numerous files scattered everywhere on the computer at work into easy to use folders for my staff to access simply. ...
    (uk.comp.homebuilt)