I am writing an MSBuild target/xml configuration file.
Let's say I have two folders in my project source folder which I want to copy over. I want to copy over just these folders (and their contents), and ignore the other folders.
The specification below is copying the correct files, however they are all just dumped into one folder. The two top level folders (bin and obj) are lost, and their contents are just combined into one folder.
I want to basically copy the two folders into the new top level folder, exactly as they and their contents are.
Script
<Target Name="Package" DependsOnTargets="Build">
<Message Text="Copying."></Message>
<ItemGroup>
<PackagedFiles Include="$(PipelineFolder)MyFolder\bin\**;
$(PipelineFolder)MyFolder\obj\**" />
</ItemGroup>
<MakeDir Directories="$(PipelineFolder)CopiedFolder" />
<Copy SourceFiles="@(PackagedFiles)" DestinationFolder="$(PipelineFolder)CopiedFolder\%(RecursiveDir)%(Filename)%(Extension)" />
</Target>
What is the easiest way to copy just the top level folders, I guess the wildcard in the PackagedFiles are pointing to everything within these folders. I can't do this from the folder above the working directory as then I will copy all the other folders (not just the ones I want, bin and obj).
Thanks.