Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Cyclic Copy Error ...Help  (Read 12535 times)

0 Members and 1 Guest are viewing this topic.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Cyclic Copy Error ...Help
« on: December 02, 2008, 12:55:24 PM »
   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

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Cyclic Copy Error ...Help
« Reply #1 on: December 02, 2008, 01:40:07 PM »
If the command is searching the whole drive- bear in mind that  it is finding the newly copied version as well. Although I would have guessed it would cause a "file cannot be copied onto itself" error.

I assume that is supposed to copy all SAV files on the drive to a specific location? Try excluding your Saved folder, as such:

Code: [Select]
FOR /R %%G IN (*.sav) DO XCOPY /s /d /y /EXCLUDE:C:\SAVED\ "%%G" "C:\Saved\"

I was trying to dereference Null Pointers before it was cool.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Cyclic Copy Error ...Help
« Reply #2 on: December 02, 2008, 03:02:48 PM »
Hey Thanks!!!

Never knew there was an exclusion ability. Never used it before, but sure will be using it now.

This should do it, and yes it is to scan entire HD for matches and copy matched by file extsnion files to that saved location on C:

 ;)