Processing files in batch

  • Thread starter Thread starter JS
  • Start date Start date
Is there a way to filter files by date/time within a batch (BAT/CMD) script
and remove old files? I looked help for usage of FOR command but seems
it cannot help me to achieve above thing. Any ideas?
 
Tumurbaatar S. said:
Is there a way to filter files by date/time within a batch (BAT/CMD) script
and remove old files? I looked help for usage of FOR command but seems
it cannot help me to achieve above thing. Any ideas?

To filter out today's files:

dir /s | find "05/23/2006"
 
Tumurbaatar S. said:
But how to send files/names from the DIR to FOR loop?

Since your post lacks a detailed description of what
exactly you're trying to do, my reply is equally sparse
and little more than a guess:

Line1 @echo off
Line2 for /F "tokens=4" %%a in ('dir /s /a-d ^| find "05/23/2006"') do
echo File= %%a
 
Tumurbaatar S. said:
But how to send files/names from the DIR to FOR loop?

Also: Please fix your PC time and/or time zone. You're
posting in the future (which you can already see if you
look at your first post and JS's reply).
 
Tumurbaatar said:
Is there a way to filter files by date/time within a batch (BAT/CMD) script
and remove old files? I looked help for usage of FOR command but seems
it cannot help me to achieve above thing. Any ideas?
Try poseting your question in microsoft.public.basic.dos.
I know, I know! There's no DOS in XP. Still, that forum discusses batch
files often.

Bill
 
Back
Top