Xcopy bug

Microsoft Windows
Post Reply
SteveSi
Posts: 2
Joined: 2022-Oct-20, 9:41 am

Xcopy bug

Post 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:\
User avatar
Simon Sheppard
Posts: 190
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Xcopy bug

Post 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.
SteveSi
Posts: 2
Joined: 2022-Oct-20, 9:41 am

Re: Xcopy bug

Post 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).
User avatar
Simon Sheppard
Posts: 190
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Xcopy bug

Post 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
Post Reply