copy files of a particular date
|
Original Message
|
Name: gauravjee
Date: June 29, 2006 at 05:34:16 Pacific
Subject: copy files of a particular dateOS: DOSCPU/Ram: 512Model/Manufacturer: Intel |
Comment: Is there a way i can copy/ move the files from a specific directory which have been modified on a particular date i was able to get a list of files using the following script dir /a-d |find "02/10/2006" >filelist.txt but now if i want to copy the files i am confused as to how to do it Please help ThanksGaurav
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: ghostdog
Date: June 29, 2006 at 06:40:41 Pacific
Subject: copy files of a particular date |
Reply: (edit)since you have all the directories that are on certain dates in filelist.txt, just make a for loop over this list, and use the copy command in the for loop to copy your directories... eg for [options] %%var in (filelist.txt) do ( copy %%var to destination )
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Shr0Om
Date: June 29, 2006 at 06:41:01 Pacific
Subject: copy files of a particular date |
Reply: (edit)This should work. It will copy all files in filelist.txt to a target folder. ::----CODE---- for /f %%i in (filelist.txt) do copy "%%i" "c:\TargetFolder" ::----CODE----
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: gauravjee
Date: June 29, 2006 at 22:03:25 Pacific
Subject: copy files of a particular date |
Reply: (edit)hi This doesnt work because the filelist.txt looks like this it is the output of dir f:\pics /a-d |find "03/04/2006" >j:\filelist.txt 03/04/2006 12:16p 37,882 gaurav.jpg 03/04/2006 12:17p 32,859 PICT3598.jpg 03/04/2006 12:17p 34,889 PICT3599.jpg now if i run the code given by Shr0Om i.e. for /f %%i in (j:\filelist.txt) do copy "%%i" "j:\test" the output is J:\batch scripts>copy "f:\pics\03/04/2006" "j:\test" The system cannot find the path specified. Please help ThanksGaurav
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: ghostdog
Date: June 29, 2006 at 22:18:25 Pacific
Subject: copy files of a particular date |
Reply: (edit)why not use the xcopy command instead. It can copy files based on dates.Check out xcopy /? and look at /D:m-d-y option
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: Mechanix2Go
Date: June 30, 2006 at 05:37:20 Pacific
Subject: copy files of a particular date |
Reply: (edit)for /f "tokens=4" %%X in ('dir/a-d ^| find "30-06-2006"') do ( echo copy or move %%X somewhere ) ======================= That's either all ONE line or it can break immediately before "echo" ===================================== If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
|
Response Number 8
|
Name: Shr0Om
Date: June 30, 2006 at 06:15:14 Pacific
Subject: copy files of a particular date |
Reply: (edit)Hmmye.. Was a little to quick there:P But i see solutions to the problem is already posted.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: