Solved

Robocopy Deleting Files at Destination

Posted on 2015-02-11
10
121 Views
Last Modified: 2015-02-11
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!
0
Comment
Question by:fireguy1125
  • 5
  • 4
10 Comments
 
LVL 53

Expert Comment

by:Bill Prew
ID: 40604739
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
 
LVL 24

Expert Comment

by:NVIT
ID: 40604740
Remove /MIR
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 40604762
ROBOCOPY has a lot of important options, make sure you read carefully:

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

~bp
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 1

Author Comment

by:fireguy1125
ID: 40604769
I removed /MIR, but now it's not copying anything.
0
 
LVL 1

Author Comment

by:fireguy1125
ID: 40604782
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
 
LVL 53

Expert Comment

by:Bill Prew
ID: 40604792
I would replace /MIR and /XX with just /E.  Seems more logical.

~bp
0
 
LVL 1

Author Comment

by:fireguy1125
ID: 40604822
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
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 40604825
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
 
LVL 1

Author Closing Comment

by:fireguy1125
ID: 40604827
Thanks Bill!
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 40604831
Welcome, glad that helped.

~bp
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question