Recursive Copy in MsBuild

Simply because I always forget the syntax for this, here’s how to recursively copy a set of files from one folder to another using the <Copy> task.

<Target Name="CopyNewTags">
		<FilesToCopy Include="$(FromThisFolder)**\*.*" />
	<Copy SourceFiles="@(FilesToCopy)"
		DestinationFolder="$(ToThisFolder)%(RecursiveDir)" />

The magic, of course, is in using the multi-star notation in the ItemGroup include and in using the meta value %(RecursiveDir) in the destination folder attribute.