Click here to Skip to main content
15,921,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i am using Exclude command with

XCopy /Y "E:\SOURCE FOLDER\" "E:\DESTINATION FOLDER\" /EXCLUDE:"E:\DESTINATION FOLDER\ExcludedFileList.txt"

it is showing error can't read file. I think this is because of EXCLUDE command.EXCLUDE command not excepting the path with space folder name with space like "DESTINATION FOLDER"

Running xcopy command only the it is working.
i.e
XCopy "E:\SOURCE FOLDER\" "E:\DESTINATION FOLDER\" 


What I have tried:

XCopy /Y "E:\SOURCE FOLDER\" "E:\DESTINATION FOLDER\" /EXCLUDE:"E:\DESTINATION FOLDER\ExcludedFileList.txt"
Posted
Updated 18-Aug-20 2:42am
v2

The file name looks wrong to me:
/EXCLUDE:"E:\DESTINATION FOLDER\EexcludedFileList.txt"
                                 ^
                                 |
Are you sure you need two "e"s in there?
/EXCLUDE:"E:\DESTINATION FOLDER\ExcludedFileList.txt"
Looks a lot more likely, and that would fit with the error message.
 
Share this answer
 
Comments
Siddharth Rai 18-Aug-20 8:38am    
HI,

C:\WINDOWS\system32>XCOPY /Y "E:\SOURCE FOLDER" "E:\DESTINATION\" /exclude:E:\DESTINATION FOLDER\ExcludedFileList.txt
ERROR Can't read file

C:\WINDOWS\system32>XCOPY /Y "E:\SOURCE FOLDER" "E:\DESTINATION\" /exclude:E:\EXCLUDE\ExcludedFileList.txt

Working fine because i change DESTINATION FOLDER --> EXCLUDE (No space)
Richard MacCutchan 18-Aug-20 9:49am    
Why not just put the name in double quotes as already suggested?

I just tried this, and for some reason xcopy mis-parses the /exclude option.
That is correct. The command processor treats a space as a parameter separator, so you must put such a path name in quotes to ensure it is treated as a single item. Are you sure you have spelled the filename correctly?
 
Share this answer
 
Comments
Siddharth Rai 18-Aug-20 7:46am    
YES, File name is correct.
Richard MacCutchan 18-Aug-20 9:48am    
Well you have changed it from your original question. But the message is clearly telling you that the filename is incorrect.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900