I have a cross-platform build toolchain which copies some folders to destination. I use
robocopy on Windows and
rsync on macOS because they support console progress output. The commands were in this form:
robocopy "C:\Some\Source" "C:\Some\Destination" /MIR rsync -a --progress --delete "/Some/Source/" "/Some/Destination"
But now I am met with a situation where I need to exclude some files that may appear in the source directory. And I need them to be erased in the destination if they were there before.
rsync -a --progress --delete-excluded --exclude '*.jpg' "/Some/Source/" "/Some/Destination"
But I can't make
robocopy act like this using the
robocopy "C:\Some\Source" "C:\Some\Destination" /MIR /XF *.jpg
robocopy keeps old excluded files at the destination. Is there a way to make
robocopy behave like
rsync with the
--delete-excluded option? I know I can scan the destination tree later to remove excluded files with another command but I would like to do it with
robocopy because the tree is really huge and I want to save time with the copy operation.