Solved

Robocopy Deleting Files at Destination

Posted on 2015-02-11
10
125 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 55

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 55

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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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 55

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 55

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 55

Expert Comment

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

~bp
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

728 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