Jignesh Thakker Jignesh Thakker - 1 year ago 117
C# Question

Pre Build Event: Copy Folder and it's SubFolders and files into Build Directory using XCopy

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


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
. Can anyone point me How can I do this?


Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download