26

I have Window Application and I have some plugins & it's ChildPlugins which I placed in My Application folder structure(see folder structure image). I used SVN as source control so, every folder has .SVN folder.

Here is My Question:

Below image is my directory structure for Plugins. All folder have some files related it plugins. Now I want to copy all folder (with SubFolders) & it's files to my Application Build output path by using Pre Built Event.

**Plugins Directory structure**

After searching on net I found that by using XCopy I can achieve what I want. By using below code I can copy Plugins directory & it's files but can't able to copy it's sub folders & Sub folder Files .

xcopy "$(SolutionDir)Plugins\*.*" "$(SolutionDir)Windows\Host\Host.GUI\bin\x86\$(ConfigurationName)\Plugins\" /Y/D

I want to copy Folder & it's all subfolders with all files and want to exclude .SVN. Can anyone point me How can I do this?

Thanks.

Jignesh Thakker
  • 3,638
  • 2
  • 28
  • 35
  • As @CrazyCasta's answer after adding /E in my code It's working perfectly. xcopy "$(SolutionDir)Plugins\*.*" "$(SolutionDir)Windows\Host\Host.GUI\bin\x86\$(ConfigurationName)\Plugins\" /Y/D/E – Jignesh Thakker Sep 25 '12 at 07:01

4 Answers4

33

I have used this:

xcopy "$(ProjectDir)MyFolder\*.*" "$(SolutionDir)ConsoleApplication1\bin\Release\MyFolder" /Y /I /E

And worked fine, the folder 'MyFolder' appear into my 'Release' folder when I compile the project with all the documents in it.

Something to point out here is that the path that is after $(SolutionDir) would change depending of the name of your solution, my solution is ConsoleApplication1.

Mario Berthely
  • 441
  • 5
  • 7
25

You need to add the /E switch to copy subdirectories (including Empty ones).

jimhark
  • 4,938
  • 2
  • 27
  • 28
CrazyCasta
  • 26,917
  • 4
  • 45
  • 72
17

Better if it doesn't require a path with solution name or configuration type:

xcopy "$(ProjectDir)MyFolder\*.*" "$(TargetDir)\MyFolder" /Y /I /E
Adam Finley
  • 1,550
  • 1
  • 16
  • 28
1

Here is an example of copying Assets folder (located in the project folder) into bin(debug or release ...)\Assets

<Target Name="BeforeBuild">
    <Exec Command="xcopy &quot;$(ProjectDir)Assets\*.*&quot; &quot;$(ProjectDir)bin\$(Configuration)\Assets&quot; /Y /I /E" />
</Target>

Note, double quotes are replaced with a special word

Artiom
  • 7,694
  • 3
  • 38
  • 45