Tuesday, December 8, 2015

Does destination specify a file name or directory name on the target while using XCopy

I was recently setting up some build steps to use XCopy when I suddenly encountered the following error message:

Does destination specify a file name or directory name on the target (F = file, D = directory)? 

Well, there was a lot of confusion about how to solve this issue even after reading this TechNet article: https://technet.microsoft.com/en-us/library/bb491035.aspx 

While the TechNet article advises using the /i switch, that will not work when you are dealing with just a single file.

Therefore, the better approach is to simply modify your XCopy command to use the following instead:

xcopy C:\SrcDir\SrcFile.txt  C:\DestDir\* /Y

This will allow you to avoid getting the File or Directory prompt and allow you to run your scripts unattended!

No comments:

Post a Comment