How to Recursively Delete a Directory in PowerShell


If you want to recursively delete a directory/folder using PowerShell, then you have 2 options.

Option 1 – With LiteralPath and Force

Remove-Item -LiteralPath "myFolder" -Force -Recurse

Option 2 – With implicit and Recurse

Remove-Item myFolder/* -Recurse