PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

Delete files older than X days

 
 
babu
Guest
Posts: n/a
 
      29th Jun 2004
Can you let me know..how to delete files older than X
days in Windows 2000 server only..

I tried using forfiles.. but it doesn't have flexibilty
that it can't accept filename more than 8.

Can anyone let me know whether its a bug or thats the way
forfiles works..

Thanks & appreciate ur help

BAbu


 
Reply With Quote
 
 
 
 
Phil Robyn [MVP]
Guest
Posts: n/a
 
      29th Jun 2004
babu wrote:

> Can you let me know..how to delete files older than X
> days in Windows 2000 server only..
>
> I tried using forfiles.. but it doesn't have flexibilty
> that it can't accept filename more than 8.
>
> Can anyone let me know whether its a bug or thats the way
> forfiles works..
>
> Thanks & appreciate ur help
>
> BAbu
>
>


That is *not* the way FORFILES works. You probably are not
using the right command syntax, or else you don't have the
latest version of FORFILES.

--
Phil Robyn
Univ. of California, Berkeley

u n z i p m y a d d r e s s t o s e n d e - m a i l
 
Reply With Quote
 
Paul R. Sadowski
Guest
Posts: n/a
 
      29th Jun 2004

"babu" <(E-Mail Removed)> wrote in message
news:22a0201c45e11$4b90eae0$(E-Mail Removed)...
> Can you let me know..how to delete files older than X
> days in Windows 2000 server only..
>
> I tried using forfiles.. but it doesn't have flexibilty
> that it can't accept filename more than 8.


Perhaps you can post what you are using. Could it be that you need to quote
the filename like below?
C:\Users\Sadowski [(firecat) 16:08, Tue 06/29/2004]
forfiles -pc:\temp\captures -mcapture*.* -d-2 -c"cmd /c echo
""@PATH\@FILE"""
"c:\temp\captures\Capture3-18-2004-2.02.28 AM.gif"
"c:\temp\captures\Capture6-23-2004-5.32.03 PM.jpg"
"c:\temp\captures\Capture6-24-2004-1.34.14 PM.jpg"


 
Reply With Quote
 
Torgeir Bakken \(MVP\)
Guest
Posts: n/a
 
      29th Jun 2004
babu wrote:

> Can you let me know..how to delete files older than X
> days in Windows 2000 server only..
>
> I tried using forfiles.. but it doesn't have flexibilty
> that it can't accept filename more than 8.
>
> Can anyone let me know whether its a bug or thats the way
> forfiles works..

Hi

In the article below there is a WSH script (vbscript) by Michael Harris
that deletes files x days old in a specific folder (and optionally all
subfolders).

Newsgroups: microsoft.public.scripting.wsh
Date: 2002-10-07 08:12:33 PST
http://groups.google.com/groups?selm...D7%40hydro.com



WSH 5.6 documentation (local help file) can be downloaded from
here if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/com...r/default.mspx
 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      30th Jun 2004
On Tue, 29 Jun 2004 12:43:04 -0700, "babu" <(E-Mail Removed)> wrote
in microsoft.public.win2000.cmdprompt.admin:

> Can you let me know..how to delete files older than X
>days in Windows 2000 server only..

[snip]

Using 4NT, this command will delete files older than 7 days:
DEL /[d-7,1980/1/1]

I use this regularly to delete old log files and such.

4NT's date ranges are documented at
<http://jpsoft.com/help/dateranges.htm>

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
Jerold Schulman
Guest
Posts: n/a
 
      30th Jun 2004
On Tue, 29 Jun 2004 12:43:04 -0700, "babu" <(E-Mail Removed)> wrote:

> Can you let me know..how to delete files older than X
>days in Windows 2000 server only..
>
>I tried using forfiles.. but it doesn't have flexibilty
>that it can't accept filename more than 8.
>
>Can anyone let me know whether its a bug or thats the way
>forfiles works..
>
>Thanks & appreciate ur help
>
>BAbu
>

DELOLD freeware at tip 274 in the 'Tips & Tricks' at http://www.jsiinc.com

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Reply With Quote
 
Babu
Guest
Posts: n/a
 
      30th Jun 2004
Can you let me know the best way to use it.. below is my
code to delete files older than 4 days

forfiles -pc:\test -d-4 -c"CMD /C DEL /Q ""@PATH\@FILE""

Babu
>-----Original Message-----
>On Tue, 29 Jun 2004 12:43:04 -0700, "babu"

<(E-Mail Removed)> wrote
>in microsoft.public.win2000.cmdprompt.admin:
>
>> Can you let me know..how to delete files older than X
>>days in Windows 2000 server only..

>[snip]
>
>Using 4NT, this command will delete files older than 7

days:
> DEL /[d-7,1980/1/1]
>
>I use this regularly to delete old log files and such.
>
>4NT's date ranges are documented at
><http://jpsoft.com/help/dateranges.htm>
>
>--
>Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
>.
>

 
Reply With Quote
 
Babu
Guest
Posts: n/a
 
      30th Jun 2004
Can you let me know the best way to use it.. below is my
code to delete files older than 4 days. I need to delete
test and subdirtory files older tahn 4 day.

Below is the code

forfiles -pc:\test -S -m*.bak -d-4 -c"CMD /C
DEL /Q ""@PATH\@FILE""

Thanks & apprecaite ur help


Babu
>-----Original Message-----
>
>"babu" <(E-Mail Removed)> wrote in message
>news:22a0201c45e11$4b90eae0$(E-Mail Removed)...
>> Can you let me know..how to delete files older than X
>> days in Windows 2000 server only..
>>
>> I tried using forfiles.. but it doesn't have flexibilty
>> that it can't accept filename more than 8.

>
>Perhaps you can post what you are using. Could it be that

you need to quote
>the filename like below?
>C:\Users\Sadowski [(firecat) 16:08, Tue 06/29/2004]
>forfiles -pc:\temp\captures -mcapture*.* -d-2 -c"cmd /c

echo
>""@PATH\@FILE"""
>"c:\temp\captures\Capture3-18-2004-2.02.28 AM.gif"
>"c:\temp\captures\Capture6-23-2004-5.32.03 PM.jpg"
>"c:\temp\captures\Capture6-24-2004-1.34.14 PM.jpg"
>
>
>.
>

 
Reply With Quote
 
New Member
Join Date: Apr 2011
Posts: 2
 
      22nd Apr 2011
I think I have written a VBScript application that does what you want and a bit more The code is zipped up and can be downloaded via the linked to page!

http://www.code-bytes.com/Automate_W...ive_Files.html
http://www.code-bytes.com/Automate_W...ive_Files.html


* The code that I have allows you to Delete and/or archive files by specifying ...
1.)directory to be searched
2.) age of the file
3.) Use regular expressions to allow for pattern matching file names.


The script is highly configurable and creates a log of actions taken on files matching your criteria.


If you find the code useful/helpful/or a waste of time then please let me know. All feed back and requests for enhancements welcome!


The code is free, but if it really helps you please feel free to donate
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete all files, which older than 5 days Thomas Bauer Microsoft C# .NET 2 8th Jan 2008 08:05 PM
Re: "delete files older than X (working) days" BEN.RITCHEY@family-news.org Freeware 0 13th Feb 2005 08:08 AM
how to delete folders and files older than 14 days old Eric Microsoft Windows 2000 Security 5 15th Dec 2004 10:27 PM
Delete files older than X days old. Kenneth Keeley Microsoft Windows 2000 File System 3 1st Sep 2004 12:58 AM
Re: delete backup files older than 10 days Jonathan de Boyne Pollard Microsoft Windows 2000 CMD Promt 0 21st Jul 2003 03:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:34 PM.