Solved

delete files through a batch process based on access time

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XP pro; manually run services in registry? 15 26
Adprep 12 61
Win 2000 Pro - RDP Connection 2008 R2 Terminal Service 4 531
Windows 2000 Print Server 2 1,018
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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 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