Robocopy keeps copying same folder over and over again

I've recently started to use Robocopy for my daily backups.  It seems to work well but I have one issue.  It keeps copying the one folder over and over again.

I'm running Windows Vista and so far ever folder has copied with no problem except for the C:\Users folder.  I've tried to setup the batch file to copy the files and keep the same directory structure but it keeps copying a "Documents and Settings" folder with a subfolder for "All Users" which I don't even see as a valid folder on my PC (I am showing hidden files/folders).  To make matters worse, this folder apparently has some subfolders that it just keep copying over and over again, nesting them within themselves.

For instance, if the Users folder has subfolders called 1,2,3,4, and 5, then folders are created with those names but for some reason folder 5 gets new folders created for 1,2,3,4,5, then again #5 has them created, and again and again.  Maybe I'm just missing something but I can not figure this out!

My batch file line to kickoff the backup is as follows:

robocopy C:\ P:\%ComputerName%\  /S /COPY:DAT /XO /ZB /R:0 /W:0 /ETA /MON:5 /XA:STH

Can someone let me know what I'm doing wrong?  Thanks in advance for your help!
maianoelAsked:
Who is Participating?
 
LeeTutorConnect With a Mentor retiredCommented:
The C:\Users\<useraccountname> folder has a number of symbolic links in it which you can only see when hiding files and folders is turned off in Folder Options. E.g., My Documents is a symbolic link to C:\Users\<account>\Documents. These symbolic links are there to make it easier for older programs written for XP able to work without having to be modified to reflect Vista's new folder structure. These are probably what are causing the problem. To see the symbolic links, go to the CMD prompt in the \Users\<useraccountname> folder and type DIR /AL
0
 
BrandonGalderisiConnect With a Mentor Commented:
I had a problem similar to that.  The problem that "I" had was because somehow I had a shortcut in a folder that pointed to another folder in it's lineage.  So a shortcut to it's grandparent.  It would seem to get it stuck in a loop.
0
 
maianoelAuthor Commented:
Really... how were you able to locate the short cut and fix the issue?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
maianoelAuthor Commented:
to make matters worse I've even looked through my C: drive and I don't even see a directory structure that matches what Robocopy is even backing up...
0
 
maianoelAuthor Commented:
great, thanks... and I'm sorry, now that I've done that what do I do about it?  I don't see anything listed which has a symbolic link referencing Documents and Settings.  Is there a way to fix the links or change the batch file to prevent this?
0
 
LeeTutorretiredCommented:
There is a Documents and Settings symbolic link in the C: root directory.  I'm not sure what you can do about it.
0
 
maianoelAuthor Commented:
Thanks for pointing me in the right direction, guys... this really helped me solve my problem!
0
 
maianoelAuthor Commented:
Great, thanks guys, this really helped me.  Apparently if you add the /XJ switch it will exclude the junction points.  Once I did that my backup is now running like it should.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.