Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

delete files through a batch process based on access time

Posted on 2004-04-13
2
Medium Priority
?
530 Views
Last Modified: 2010-04-13
Hi
I want to set up a script in windows 2k, to scan certian dir and file extensions based on their last access time (say a week ago). I know how to do this on unix machine. I am wondering if any one can help on this.
thank you
sarma
0
Comment
Question by:schilukuri
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
wtrmk74 earned 400 total points
ID: 10819580
Download ForFiles.EXE from the windows 2000 Resource Kit Here
http://www.dynawell.com/reskit/microsoft/win2000/forfiles.zip

Download to your WINNT Directory !

Info on basic setup and functionality:
http://www.microsoft.com/resources/documentation/WindowsServ/2003/standard/proddocs/en-us/Default.asp?url=/resources/documentation/WindowsServ/2003/standard/proddocs/en-us/forfiles.asp

Then open NOTEPAD and copy this text:
------------------------------------------------------------------------------------------------------------
@Echo OFF
Echo Deleting files older than 7 days in the specified directory !
Echo ...........................................................
Echo Are you ready to begin file deletion ?
Pause
forfiles -pc:\TestFolder -s -d-7-c"cmd /c del ""@FILE"" /Q /F"
Echo You have successfully deleted the specified files in your directory !
Pause
Exit
------------------------------------------------------------------------------------------------------------
Save As....filedel.bat in your C:/Drive
and then Run from Command Line:    %SystemDrive%/filedel.bat

I created an example based on
DRIVE                         = C:
Folder Name               = TestFolder
Search Subdirectories  = -s
Date Range                 = -7
Command                   = -c"cmd /c del "
Variable                      = @FILE
Switches                     = /Q quiet , F/ force

Have fun
wtrmk74
0
 
LVL 7

Expert Comment

by:wtrmk74
ID: 10846903
Glad it all worked out !

Take Care
wtrmk74
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question