6

I need to copy folder A to folder B and folder A is having subfolders. I have tried xcopy and copy both are stuck.

C:\Users>xcopy  sushantg\A\* sushantg\B /s /e /h /T
Does sushantg\B specify a file name
or directory name on the target
(F = file, D = directory)?
Does sushantg\B specify a file name
or directory name on the target
(F = file, D = directory)?
1
  • Try xcopy sushantg\A\*.* sushantg\B\*.* /s /e /h /T Jul 1, 2014 at 15:05

2 Answers 2

9

You have two main options here:

The first option is to add the /i parameter. The related text in the documentation is as follows:

If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes Destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.

Another option is to specify that the destination is a directory by ending it with a backslash, which would make the code look like this:

xcopy  sushantg\A\* sushantg\B\ /s /e /h /T

(Note the trailing backslash after the B)

I can't find any relevant documentation for this option at the moment, but I tested it locally and it fixed the issue.

1
  • I had a similar problem and adding a trailing backslash to the destination folder (your second option) fixed the issue. Thank you.
    – mguassa
    Feb 22, 2016 at 11:25
-1

Try:

echo f | Xcopy /f /y sushantg\A\* sushantg\B /E /H

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.