incorrect handling of files to exclude by robocopy.exe, if /XF flag is used with relative path

New Contributor



while running 'robocopy' command found, that files, marked to exclude in target directory by '/XF' flag are still removed.


reproduced, if:
- '/XF <relative path>' is used
not reproduced, if:
- '/XF <absolute path>' is used
, see testcase in attachment.


both 'robocopy' run in the testcase prints to the output:


Source : C:\TEST_SOURCE\


which mean it converts path of source and destination directories to absolute, if relative, and:


Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 0 0 0 0 0 1


which mean it "thinks" job was finished successfully.


the difference is that if '/XF <relative path>' is used, 'robocopy' prints:


*EXTRA File 0 __KEEP_ME__


while if '/XF <absolute path>' is used, it prints:


Exc Files : C:\TEST_TARGET\__KEEP_ME__
*named file 0 __KEEP_ME__


which mean it don't convert '/XF <relative path>' to '/XF <absolute path>' prior run and thus don't exclude files.


the same can be for other File Selection Options ('/XD', etc.) or even Logging Options ('/LOG:file', etc.), need be verified.


Alex Shevchenko


0 Replies