msbuild copy

Copy directory recursively task in MSBuild

So I ran into a situation where I needed to copy a directory to a specific destination through MSBuild.

This is how I could achieve my goal.

<Project xmlns="">
<CloudArtifacts Include=".Cloud\Data\**\*.*"/>
<Target Name="CopyFiles">
<Copy SourceFiles="@(CloudArtifacts)" DestinationFiles="@(CloudArtifacts->'c:\PackableFiles\%(RecursiveDir)%(Filename)%(Extension)')" />

We can get more details on MS Build Copy task in this link.