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
Code language: JavaScript (javascript)

Option 2 – With implicit and Recurse

Remove-Item myFolder/* -Recurse
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments