What tool can I use to delete files older than a specified number of days
(on command line)?
What tool can I use to delete files older than a specified number of days
(on command line)?
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.
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
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 ?
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.
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.
Bookmarks