Why can't I run a batch file to copy files?

I'm just trying to run a simple batch script to copy a file:

xcopy /s c:\source\document.txt c:\destination

Nothing is copied, and I get the response:

0 File(s) copied

I've done this before and it's worked fine. I don't understand the problem.

2

2 Answers

You are specifying paramter /s, which means: Copy this folder and subfolders, but your source is a file, not a folder.

Due to /s, the source is assumed to be a folder, but it actually is not.

Remove the /s paramter, and all should work fine.

If you indeed want to copy that folder AND all subfolders, remove the filename and only specify the folder, followed by *.*

3

I determined that all the files I was trying to copy were hidden files, so the only way Xcopy will copy them is by adding the /h option, which solved the problem!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like