Solved

delete files through a batch process based on access time

Posted on 2004-04-13
2
513 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 100 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
auto copy 8 610
Restore SQL database from 8.0 to 11.00 ? 3 1,111
windows 2000 image 3 121
Migrating from IIS5 to IIS8.5 3 152
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…
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now