Robocopy Deleting Files at Destination

I'm copy user documents from another company provided on USB drive to the user's home folder in my company.  The user has been creating folders and files in the destination location, but when I run the robocopy job, it deletes all of these files and folders, and replaces them only with what I have on the USB drive.  Please advise which parameters I should change to prevent his from occuring:

robocopy "F:\Documents\User1" "\\fileshare\User\Personal\User1" /MIR /COPY:DATOU /DCOPY:T /R:1 /W:1 /XO /LOG:F:\User1log.txt

Can I just add the /XX parameter, to exclude the extra files? That is what is being logged that there are Extra directories and files.

Do I use in conjunction with the /XO parameter?

Thanks in advance!
LVL 1
fireguy1125Asked:
Who is Participating?
 
Bill PrewConnect With a Mentor Commented:
They should accomplish the same result.

/MIR is equal to /E and /PURGE

/XX essentially undoes the /PURGE

so effectively they end up at the same place.

~bp
0
 
Bill PrewCommented:
The /MIR is your problem, it is forcing the two folders to be "synced", so extra files are being deleted from the dest.

~bp
0
 
NVITCommented:
Remove /MIR
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
Bill PrewCommented:
ROBOCOPY has a lot of important options, make sure you read carefully:

https://technet.microsoft.com/en-us/library/cc733145.aspx

~bp
0
 
fireguy1125Author Commented:
I removed /MIR, but now it's not copying anything.
0
 
fireguy1125Author Commented:
It seems to be working by using:

robocopy "F:\Documents\User1" "\\fileshare\User\Personal\User1" /MIR /COPY:DATOU /DCOPY:T /R:1 /W:1 /XO /XX /LOG:F:\User1log.txt

I only added the /XX, and folders and files that already existed in the destination were kept intact.

Are there any unforseen issues with using the above command?
0
 
Bill PrewCommented:
I would replace /MIR and /XX with just /E.  Seems more logical.

~bp
0
 
fireguy1125Author Commented:
Thanks, i'm not following what the difference would be between the two:

robocopy "F:\Documents\User1" "\\fileshare\User\Personal\User1" /MIR /COPY:DATOU /DCOPY:T /R:1 /W:1 /XO /XX /LOG:F:\User1log.txt

robocopy "F:\Documents\User1" "\\fileshare\User\Personal\User1" /E /COPY:DATOU /DCOPY:T /R:1 /W:1 /XO /LOG:F:\User1log.txt
0
 
fireguy1125Author Commented:
Thanks Bill!
0
 
Bill PrewCommented:
Welcome, glad that helped.

~bp
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.