Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy only existing files with robocopy

a service is running on many servers and on some machines I need another set of plugins than on other machines for this service.

On all those hosts there is already the folder with some plugin files needed for that host. Now I need to update those from one single source.

It is important that robocopy only copies the file from the source that are already in the folder on the server, and not any additional files.

I thought the /XX flag would do this, but it doesn't work for me.

This is the command I used:

robocopy <src> <dst> /E /XX /NP

What command would be the right one for me?

like image 951
meilon Avatar asked Aug 01 '12 12:08

meilon


People also ask

Does Robocopy copy existing files?

Copy files without overwrite /E makes Robocopy recursively copy subdirectories, including empty ones. /XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those. /XN excludes existing files newer than the copy in the source directory.

How do you copy only files that have changed Robocopy?

To copy only changed files with Robocopy, you have two options, namely using maxage: n or /XO /maxage: n. Some users say that they don't want to create all the subfolders on the target disk if there is no new files in them. In this case, you need to add extra switch /S to exclude the empty folder.

How do you copy only files that do not exist on destination?

If you are copying files using drag-drop or copy/paste, you may simply choose “Skip this file” or “Skip these files” option to not overwrite the files that are already existed at the destination folder. Or, if you are using command line copy, you can answer N to bypass these files that are already existed.

Can Robocopy copy individual files?

RoboCopy is used as a tool to copy folders but it can also be used to copy single files if required. This is handy if you're copying a large file (such as an ISO or WIM image) and want some sort of feedback from a command prompt on how it's progressing (not something that happens with xcopy or copy).


1 Answers

Okay, the German translation is a little bit bad. The original English help from robocopy tells me exactly what to use:

/XL : eXclude "Lonely" files and dirs (present in source but not destination)
      This will prevent any new files being added to the destination.

(In the German translation the very helpful part "present in source but not destination" is left out)

like image 105
meilon Avatar answered Sep 21 '22 05:09

meilon