Page 1 of 1

Xcopy bug

Posted: 2022-Oct-20, 9:48 am
by SteveSi
I found a strange bug(?) using Xcopy
You give the example
Copy all files within the 'demo' folder:
XCOPY C:\demo D:\work\april /i

on the XCOPY page, however I found an issue.

I used the command similar to

Code: Select all

XCOPY C:\demo L:\
and this works OK EXCEPT if the source folder is a compressed NTFS folder AND the destination target is the root of a non-NTFS (e.g. FAT32) drive!

Then you get a

Code: Select all

File creation error - The parameter is incorrect.
Unable to create directory - L:\
0 File(s) copied
The issue is fixed if you add a \ to the end of the source folder path,

Code: Select all

XCOPY C:\demo\ L:\

Re: Xcopy bug

Posted: 2022-Oct-20, 10:01 pm
by Simon Sheppard
I don't think this is a bug, XCOPY just thinks you are trying to copy a file called C:\demo with no file extension.
To tell it this is a directory, you need to add a trailing backslash.

When using Robocopy there is no need for a trailing space because robocopy is centered around copying a whole directory trees of files.

Re: Xcopy bug

Posted: 2022-Oct-20, 10:17 pm
by SteveSi
The command works fine if the source folder is a non-compressed folder.
It only fails if the source folder is a compressed folder.

The command line is valid (similar to that given as an example in SS64.com XCOPY page).

Re: Xcopy bug

Posted: 2022-Oct-21, 5:24 pm
by Simon Sheppard
I don't know why it behaves differently for a compressed folder, but I have changed the example on that page to use the syntax which works everywhere.

https://ss64.com/nt/xcopy.html