MrComputerIT
asked on
Can I mirror a directory with Robocopy, but leave two files in the destination directory that aren't in the source?
Hello :)
Here's what I'd like to do:
Say I have "c:\dirA" that has lots of files and subdirectories. I want to mirror that directory to "c:\dirB", adding new files/folders, deleting deleted files/folders, and updating changed files/folders. However, "c:\dirB" has two files in it "c:\dirB\File1.txt" and "c:\dirB\File2.txt" that I don't want deleted even though they are not in the source directory. Is there a way to do that with Robocopy? Any clever hacks you can think of to make this work?
Thanks!
Here's what I'd like to do:
Say I have "c:\dirA" that has lots of files and subdirectories. I want to mirror that directory to "c:\dirB", adding new files/folders, deleting deleted files/folders, and updating changed files/folders. However, "c:\dirB" has two files in it "c:\dirB\File1.txt" and "c:\dirB\File2.txt" that I don't want deleted even though they are not in the source directory. Is there a way to do that with Robocopy? Any clever hacks you can think of to make this work?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had no idea that the /xf switch could be used to exclude files from the destination. It worked perfectly! Thanks!
attrib +r c:\dirB\File1.txt
attrib +r c:\dirB\File2.txt
your robocopy command