I have tried to follow the advice here: Need to delete all the files with one extension on a drive in Windows 7
But if I want to delete all files in a specific folder, with a specific extension, that doesn't work.
I have a folder with *.ASP
and *.ASPX
files, and I need to delete all the *.ASP
files but keep the ASPX pages.
I also need to delete a folder if it is empty, after deleting the file(s).
How would I delete all the ASP pages easily, including empty folders? Command prompt is no problem.
EDIT: This is the trick in PowerShell:
Get-ChildItem -path . -recurse -include *.asp |
Where-Object {-not $_.PSIsContainer} |
Remove-Item -Verbose