Use FORFILES.EXE from the Resource Kit. If you don't have
the Resource Kit, you can download FORFILES.EXE from
ftp://ftp.microsoft.com/reskit/y2kfix/x86/
--
U s e ' R e p l y - T o ' a d d r e s s o r
u n z i p ' F r o m ' t o s e n d m a i l
<URL:http://homepages.tesco.net./~J.deBoynePollard/FGA/common-tasks-with-jpsoft-clis.html#ProcessByDate>
"Jonathan de Boyne Pollard" <J.deBoyn...@tesco.net> a écrit dans le message de news: 3E2948D3...@tesco.net...
dir D:\*.log /o-d /b > D:\log_file_list.txt
FOR /F "tokens=1 skip=6" %%i in (D:\log_file_list.txt) do del D:\%%i
del D:\log_file_list.txt
"Jonathan de Boyne Pollard" <J.deBoyn...@tesco.net> wrote in message
news:3E2948D3...@tesco.net...
XXCOPY is one solution which provide a one-line command which
is more than capable of finding and deleting files by age.
XXCOPY is an enhanced XCOPY with rich set of command witches.
It is available as freeware for personal use at
Here are some basic command switches
/L // list-only (no copy or delete)
/RS // remove (delete) from the source
/DB#<n> // select files that are n days or older
/DA#<n> // select files that are n days or younger
Here's a few examples:
xxcopy c:\mydir\* /L /DB#10 // list files 10 days or older
xxcopy c:\mydir\*.DOC /L /DB#7 // list *.DOC files, >= 10 days old
xxcopy c:\mydir\* /RS /DB10 // delete files 10 days or older
xxcopy c:\mydir\* /RS /DB#10 /DA#30 // files 10-30 day sold
xxcopy c:\mydir\* /RS /DB#1 // files made yesterday or earlier
xxcopy c:\mydir\* /RS /DA#0 // files made today (since midnight)
xxcopy c:\mydir\* /RS /DA#10H // files made within 10 hours
xxcopy c:\mydir\* /RS /DA#30M // files made within 30 minutes
xxcopy c:\mydir\* /RS /DA#90S // files made within 90 seconds
xxcopy c:\mydir\* /RS /DB#365 /S // include subdirectories
You may use an absolute value (/DA:yyyy-mm-dd , /DB:yyyy-mm-dd)
xxcopy c:\mydir\* /RS /DB:2002-10-31 // files made on or before
xxcopy c:\mydir\* /RS /DA:2001-11-01 // files made on or after
xxcopy c:\mydir\* /RS /DO:2000-01-01 // files made on the day
xxcopy c:\mydir\* /RS /DA:2001-01 // on or after 2001-01-01
xxcopy c:\mydir\* /RS /DA:2001 // on or after 2001-01-01
xxcopy c:\mydir\* /RS /DB:2001-12 // on or before 2001-12-31
xxcopy c:\mydir\* /RS /DB:2001 // on or before 2001-12-31
xxcopy c:\mydir\* /RS /DO:2001-12 // files made in 2001-12
xxcopy c:\mydir\* /RS /DO:2001 // files made during year 2001
I believe the above examples are sufficient to run the /RS (remove from
source) command in conjunction with /DA and /DB switches.
More common usage of XXCOPY is to copy files as the name implies.
In general, its command syntax is compatible with XCOPY. These are
a small fraction of what XXCOPY can do for you in variety of file
management operations.
XXCOPY is compatible with Windows 95/98/ME/NT/2K/XP. It comes with
XXCOPY16 with essentially the same set of switches for DOS environment.
One of the problems using a batch file is that it is difficult and messy
to write a good script that works well in all Windows versions.
Kan Yabumoto
The Author of XXCopy
======================================================================
"Gary Chan" <gary...@yahoo.com> wrote in message news:<03f501c2b37e$065c7910$d4f82ecf@TK2MSFTNGXA11>...
JdeBP> <URL:http://homepages.tesco.net./~J.deBoynePollard/FGA/common-tasks-with-jpsoft-clis.html#ProcessByDate>
V> This bit of batch [...]
Please _read_ the messages that you respond to.
V> [...] skipping the first 6 .log files (newest by date) then deles the rest.
At the very least, read their subject fields.
JdeBP> <URL:http://homepages.tesco.net./~J.deBoynePollard/FGA/common-tasks-with-jpsoft-clis.html#ProcessByDate>
PP> Delenda Cleanup Software lets you parameter [...]
This premise is only true for one particular vendor's command interpreter.
<URL:http://homepages.tesco.net./~J.deBoynePollard/FGA/common-tasks-with-jpsoft-clis.html#ProcessByDate>