Delete everything in a directory except for one hidden directory in MSBuild
问题 What's the best way to delete the entire contents of a directory, except for one (hidden) child directory? Thanks! 回答1: <Target Name="DeleteMe"> <ItemGroup> <DeleteMe Include="$(PathRoot)/FolderToDelete/**/*.*" Exclude="$(PathRoot)/FolderToDelete/DoNotDeleteThisHiddenFolder/**/*.*" /> </ItemGroup> <Delete Files="@(DeleteMe)" /> </Target> 来源: https://stackoverflow.com/questions/10014240/delete-everything-in-a-directory-except-for-one-hidden-directory-in-msbuild