Hello ... I have a batch that I am trying to have not loop back on itself and Cyclic Copy Error. I know that it is because the XCOPY instruction does not like to XCOPY the data from the source drive back to itself. I also want *.sav hits to copy the entire directory tree over with the *.sav files only to c:\saved so that any duplicates are not overwritten as well as each time this is run it will update the c:\saved with the latest date/time stamped copy of *.sav
@FOR /R %%G IN (*.sav) DO XCOPY /s/d/y "%%G" "C:\Saved\"
Here is the error message I get. I planted 3 *.sav files on this system to see if it would find all 3, and it found the one at c:\college\test1.sav and stops there.
Cannot perform a cyclic copy
0 File(s) copied
C:\college\test1.sav
1 File(s) copied
Cannot perform a cyclic copy
0 File(s) copied
0 File(s) copied
Press any key to continue . . .
*** If I pop in my thumb drive and change the batch to drive E:\ as the location to drop matching XCOPY data it works with no problems. But thats not what I want to have happen. I want to pool up the group of matching *.sav files to a folder on the C:\ drive of c:\saved and not have to use a thumb drive. I can after the FOR ... XCOPY instruction was completed then xcopy /s/d/y the data from the E:\ to the C:\saved, but still there has to be a way to do this without that thumb drive as a swap location.
@FOR /R %%G IN (*.sav) DO XCOPY /s/d/y "%%G" "E:\Saved\"
xcopy E:\Saved\*.sav c:\saved\*.* /s/d/y
Anyone have any suggestions as to how to do this without a 2nd Hard Drive, or a thumb drive. Is there a way to save matching data to a temporary or swap location that will allow for the data to be copied without XCOPY complaining about the source and destination being the same with Cyclic Copy Error?
Or is there a better way to do this than the routine at the heart of my batch below
@FOR /R %%G IN (*.sav) DO XCOPY /s/d/y "%%G" "C:\Saved\"
Thanks