How to delete files in Visual Studio Pre-build event command line
I am trying to delete files in my $(TargetDir)
within visual studio before building a project.
How do you have to format command line to get around this problem I am getting below?
Solution 1:
Try
cd $(TargetDir)
del *.tif
As jvenema pointed out, your $(TargetDir) is expanding into a path containing spaces in the folder names which is breaking the delete command.
Solution 2:
I ended up using rd /s /q "$(TargetDir)"
to clean out the directory. As far as I know it is working.
Solution 3:
Try adding quotes around the directory.
Solution 4:
You have to write del "$(TargetDir)*.tif"
because of spaces in directory path.