Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
Can anyone tell me how to search a drive for files and folders created or modified before a certain date and then to copy these to a new folder?
Thanks in advance
MM

Xcopy has a /d switch that allows you to copy files dated after a certain date.
Xxcopy is freeware that's similar to xcopy but has more command switches. It has a /db switch that copies files dated before a particular date. I'm not all that familiar with it, having only used it once or twice to clone a drive. You can get more info and download it at www.xxcopy.com.

I have been reading this forum to find answers for my script issue:how to ftp a filename that has a date 2 days ago(ie today May 9 I get a file filename050704.txt. I ran into issues at the first, second,8th and 9th of the month. My solution may help you:
*******************************************
rem windows 2000 script to search for file 2 days old then ftp mget
set dd=%date%set year=%dd:~12,2%
set day=%dd:~7,2%
set month=%dd:~4,2%rem check for day = 1,2,8,9
if not %day%==01 goto one
if %month%==01 set month=12
if %month%==02 set month=01
if %month%==03 set month=02
if %month%==04 set month=03
if %month%==05 set month=04
if %month%==06 set month=05
if %month%==07 set month=06
if %month%==08 set month=07
if %month%==09 set month=08
if %month%==10 set month=09
if %month%==11 set month=10
if %month%==12 set month=11
if %month%==01 set month=12
if %month%==02 goto :day2
if %month%==03 goto :day4
if %month%==04 goto :day3
if %month%==05 goto :day4
if %month%==06 goto :day3
if %month%==07 goto :day4
if %month%==08 goto :day3
if %month%==09 goto :day4
if %month%==10 goto :day3
if %month%==11 goto :day4
if %month%==12 goto :day3:one
if not %day%==02 goto :two
if %month%==01 set month=12
if %month%==02 set month=01
if %month%==03 set month=02
if %month%==04 set month=03
if %month%==05 set month=04
if %month%==06 set month=05
if %month%==07 set month=06
if %month%==08 set month=07
if %month%==09 set month=08
if %month%==10 set month=09
if %month%==11 set month=10
if %month%==12 set month=11
if %month%==01 set month=12
if %month%==02 goto :day3
if %month%==03 goto :day5
if %month%==04 goto :day4
if %month%==05 goto :day5
if %month%==06 goto :day4
if %month%==07 goto :day5
if %month%==08 goto :day4
if %month%==09 goto :day5
if %month%==10 goto :day4
if %month%==11 goto :day5
if %month%==12 goto :day4
:two
if not %day%==08 goto three
set yesterday=1006
goto start2
:three
if not %day%==09 goto start1
set yesterday=1007
goto start2
:day1
set yesterday=1027
goto month
:day2
set yesterday=1028
goto month
:day3
set yesterday=1029
goto month
:day4
set yesterday=1030
goto month:day5
set yesterday=31 goto start2
:month
set /A month=%month%+1000
set month=%month:~2,2%
goto start2
:start1
set yesterday=%day%
set /A yesterday=%yesterday%-2
set /A yesterday=%yesterday%+1000
:start2
set yesterday=%yesterday:~2,2%
:start3
set filename=asossr.%month%%yesterday%%year%*
echo open example.com > c:\ftp_outputs\ftp_example.txt
echo lcd c:\ftp_outputs >> c:\ftp_outputs\ftp_example.txt
echo cd /public_files/examples >> c:\ftp_outputs\ftp_example.txt
echo ascii >> c:\ftp_outputs\ftp_example.txt
echo prompt n >> c:\ftp_outputs\ftp_example.txt
echo ls %filename%
echo mget %filename% >> c:\ftp_outputs\ftp_example.txt
echo bye >> cc:\ftp_outputs\ftp_example.txtftp -A -s:c:\ftp_outputs\ftp_example.txt
cd c:\ftp_outputs
copy *.brid d:\accert\accert.dat
del *.brid

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |