Remove everything in a directory except one hidden directory in MSBuild

What's the best way to delete all contents of a directory except one (hidden) child directory? Thank!

+3


source to share


1 answer


<Target Name="DeleteMe">
   <ItemGroup>
      <DeleteMe
         Include="$(PathRoot)/FolderToDelete/**/*.*"
         Exclude="$(PathRoot)/FolderToDelete/DoNotDeleteThisHiddenFolder/**/*.*"
         />
   </ItemGroup>
   <Delete Files="@(DeleteMe)" />
</Target>

      



+4


source







All Articles