Вопрос

I am using Visual Studio 2012.

I have the following xcopy command

set myDir="$(SolutionDir)\MyFolder\MySubfolder"
xcopy /D /Y /I /G /R /E %myDir% "$(TargetDir)"

This only copies the contents of MySubfolder to the TargetDir. But I want it to create the whole folder.

  • Right now if I have:

    MySubfolder\file1

    MySubfolder\file2

  • And with my command I get:

    $(TargetDir)\file1

    $(TargetDir)\file2

  • I want:

    $(TargetDir)\MySubfolder\file1

    $(TargetDir)\MySubfolder\file2

I've tried several xcopy parameters but none seems to work.

Is there a way to accomplish this with xcopy?

Это было полезно?

Решение

You have to do as follows:

set myDir="$(SolutionDir)\MyFolder\MySubfolder"
xcopy /D /Y /I /G /R /E %myDir% "$(TargetDir)\MySubfolder"

Include the folder you want in the target directory also.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top