I am writing a deployment script using MSBuild. I want to clean my web directories prior to copying all the new files in. My current ‘Clean’ target looks like this:
<Target Name='Clean'> <Exec Command='del %(DeploymentSet.LocalWebRoot)\* /Q /F /S' IgnoreExitCode='true' /> </Target>
This takes an considerable amount of time as each file is deleted from each subfolder individually.
Is there a nice way to remove everything from a given folder with out deleting that folder? I want to maintain my permissions and vdir setup info.
You can
rmdir /s /qeach sub-directory individually, thendel %(DeploymentSet.LocalWebRoot)\* /Q /Fyour clean target. For example: