Using PowerShell commnads to delete a file
Example
# Using PowerShell commnads to delete a file
Remove-Item -Path "C:\test\FirstCreateFile.txt"
You can also use wildcard '*' characters to remove multiple items. For example, this command removes all the files in C:\test:
Example
# Using PowerShell commnads to delete all file
Remove-Item -Path "C:\test\*.*"
Example
# Using PowerShell commnads to delete all file force fully
Remove-Item -Path "C:\test\*.*" -Force
Example
# Using PowerShell commnads to delete all file and folders
Remove-Item -Path "C:\test\*.*" -recurse
there are shorthand aliases that work too.
As far as I understood it, the -Recurse parameter just doesn't work correctly when you try deleting a filtered set of files recursively. For deleting a single dir and everything below it seems to work fine.
Delete-SharePoint-Files-With-PowerShell