In Powershell I have a script which should clear out a folder of project files retrieved from TFS.
The command is simply:
$deletePath = 'c:\Compile\*'
Remove-Item $deletePath -Recurse -Force
Before running there are about 150 folders in c:\Compile, afterwards there are 3 folders left.
The script generates 5 errors
Remove-Item : Cannot remove item C:\Compile\DatabaseObjects: The directory is not empty.
Remove-Item : Cannot remove item C:\Compile\IFIFWCHG\obj: The directory is not empty.
Remove-Item : Cannot remove item C:\Compile\IFIFWCHG: The directory is not empty.
Remove-Item : Cannot remove item C:\Compile\PrecompiledWeb\IIS: The directory is not empty.
Remove-Item : Cannot remove item C:\Compile\PrecompiledWeb: The directory is not empty.
I thought because of the use of -Force it handled the files/folders in directories.
The funny thing is, the DatabaseObjects folder is empty after the script runs, so it seems like it is trying to delete the folder before deleting the files.