Reputation: 817
I have a deploy process that is currently using this robocopy command:
robocopy [source] [destination] /MIR /XF [file pattern] /XD [directory pattern]
The [destination]
may have additional files or directories added to it outside this process that the [source]
does not. The /MIR
flag is present because if I add files or directories to [source]
I want them to appear in the [destination]
. Also, if I remove a file/directory from [source]
that exists in [destination]
I want to remove that from [destination]
. However, this will also remove any of the new files/directories that may have been added to [destination]
.
The /XF
and /XD
flags appear to only restrict the source files/directories. Is there a corresponding way to exclude destination files from the copy? Something to indicate "When doing \MIR
don't delete directories starting with the string 'new'," for example.
Upvotes: 4
Views: 3266
Reputation: 817
Should have run more tests before asking. It appears that amending the command to be:
robocopy [source] [destination] /MIR /XF [file pattern] /XD [source directory pattern] "new*"
Does, in fact, ignore directories in the [destination]
that have "new" as the start of their name.
Upvotes: 3