Solved

delete files through a batch process based on access time

Posted on 2004-04-13
2
521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

751 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