Results 1 to 6 of 6

Thread: delete files older than...

  1. #1
    Hugo Guest

    delete files older than...

    What tool can I use to delete files older than a specified number of days
    (on command line)?

  2. #2
    Pegasus \(MVP\) Guest
    xxcopy.exe, using the /db and the /L switches.

    another option-

    Forfiles -p "<path>" -s -m *.* -d -10 -c "Cmd /C del @FILE"

    (all files older than 10 days)

    Congratulations! You must be one of a very small group
    of people able to make sense of the syntax rules of the
    forfiles.exe command.

  3. #3
    Lanwench [MVP - Exchange] Guest
    Make sense of 'em? Sure, the important ones. I know a lot of really smart
    people and I often steal^H^H^H borrow batch files from them for my own use.
    I can generally figure out what the parameters do once I see them working -
    but this isn't my area. I'm just a magpie, and the world is full of shiny
    objects.

    Thank you for using newsgroup and thanks Pegasus and Lanwench's great
    information sharing with us.

    Forfiles do a great job !

    I found a really helpful post on using forfiles and all the switches here:

    http://www.jjclements.co.uk/index.ph...number-of-days

    Could be worth checking out I think

  4. #4
    Lang Du Guest
    I am using Window XP pro. How could I get forfiles command ? Where should I
    download it ?
    Thank you.

    Never heard of forfiles, but a quick search shows that it's part of the MS
    2000 resource kit.

    You can download the reskit here:
    http://www.petri.co.il/download_free_reskit_tools.htm

    It's amazing what you can do in two minutes with Google.

    It works. However, I found a link
    http://technet2.microsoft.com/window....mspx?mfr=true
    which has different syntax with yours. Do you have any idea ? Why I cannot
    find any forfiles.exe downloads from MS web server ?

  5. #5
    David Brown Guest

    Re: delete files older than...

    Not sure. I didn't find one at MS either. Maybe it's old enough to be unsupported
    and they've offloaded or abandoned it, or it's quietly being killed.

    That may be another reason to learn to use Robocopy or the "/f" option of
    the "FOR" command built into DOS.

  6. #6
    Join Date
    May 2010
    Posts
    1

    Re: delete files older than...

    Hi. I am using the following script to delete .bak from a a directory which are older than 3 days.

    Forfiles -p "<path>" -s -m *.* -d -3 -c "Cmd /C del @FILE"

    the script works absolutely fine with Windows Vista. But it does not work on XP.

    forfiles.exe was missing in C:\Windows\System32. So I included the file in the directory.

    Still does not work.

Similar Threads

  1. Replies: 4
    Last Post: 29-05-2013, 10:19 AM
  2. Replies: 6
    Last Post: 10-08-2010, 04:14 PM
  3. rm files older than two days
    By Adonis in forum Windows Software
    Replies: 3
    Last Post: 23-06-2009, 07:15 PM
  4. Can We Delete Older NET.Framework?
    By Uriah in forum Windows Software
    Replies: 3
    Last Post: 06-02-2009, 12:27 PM
  5. Looking for a script to delete files older than 14 days
    By Michael Kapangama in forum Windows Server Help
    Replies: 3
    Last Post: 27-09-2008, 03:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,836,165.17839 seconds with 16 queries