Remove-Item with -Recurse is how you delete a directory in PowerShell, files and subfolders included. Add -Force so hidden and read-only files don’t stop it:
Remove-Item -Path C:\psfaqs\Purge\Archive -Recurse -Force
"Archive still there: $(Test-Path -Path C:\psfaqs\Purge\Archive)"
Output:
Archive still there: False

There’s no Recycle Bin and no undo. I ran everything below in a throwaway test folder, C:\psfaqs\Purge, in PowerShell 7.6 and Windows PowerShell 5.1. Where the two behaved differently, you’ll see both outputs.
Delete a directory and its contents with Remove-Item
The command above is the whole recipe. -Recurse deletes everything inside the folder first, then the folder itself. -Force takes care of hidden and read-only items, and Remove-Item prints nothing when it works.
That’s why I end with Test-Path. If you’re not sure where you are, check your current directory before you use a relative path like .\Archive.
rmdir, rd and rm are aliases for Remove-Item
Typing the old cmd.exe command works, but the cmd.exe switches don’t. In PowerShell, rmdir is just another name for Remove-Item:
'rmdir', 'rd', 'rm', 'del' | ForEach-Object { "$_ -> $((Get-Command -Name $_).Definition)" }
$folder = 'C:\psfaqs\Purge\Cache'
try { rmdir $folder /s /q -ErrorAction Stop }
catch { "rmdir /s /q: Failed. $($_.Exception.Message)" }
cmd /c rmdir /s /q $folder
"cmd rmdir: Cache still there = $(Test-Path -Path $folder)"
Output:
rmdir -> Remove-Item
rd -> Remove-Item
rm -> Remove-Item
del -> Remove-Item
rmdir /s /q: Failed. A positional parameter cannot be found that accepts argument '/s'.
cmd rmdir: Cache still there = False
So rmdir Archive -Recurse -Force works in PowerShell, while /s /q only works when cmd.exe runs the command. Microsoft lists rm and rmdir as Windows-only aliases, so use the full cmdlet name in scripts.
What happens if you skip -Recurse?
When the folder isn’t empty, Remove-Item stops and asks you to confirm. At a console you can press Y. In one of your scheduled tasks or any script run with -NonInteractive, nobody can answer, so the delete fails:
$folder = 'C:\psfaqs\Purge\Archive'
try { Remove-Item -Path $folder -Confirm:$false -ErrorAction Stop }
catch { "Failed. $($_.Exception.Message)" }
"Archive still there: $(Test-Path -Path $folder)"
Output:
Failed. PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.
Archive still there: True
Windows PowerShell 5.1 printed the same message with “Windows PowerShell” at the start. Notice that -Confirm:$false didn’t help. Microsoft documents this as by design: only -Recurse skips that prompt.
Preview a folder delete with -WhatIf
Before a recursive delete, add -WhatIf. Be aware that it lists only the folder, not the files inside, so I count them with Get-ChildItem -Recurse too:
$folder = 'C:\psfaqs\Purge\Archive'
Remove-Item -Path $folder -Recurse -WhatIf
$inside = Get-ChildItem -Path $folder -Recurse -Force
"It would also delete $($inside.Count) items inside: $($inside.Name -join ', ')"
Output:
What if: Performing the operation "Remove Directory" on target "C:\psfaqs\Purge\Archive".
It would also delete 3 items inside: 2026-07, summary.txt, sales-july.csv
When the list looks right, drop -WhatIf and run it again.
Force delete a folder with hidden or read-only files
Without -Force, one read-only file is enough to make a recursive delete fail. The error text is different in the two versions:
$folder = 'C:\psfaqs\Purge\Settings'
try { Remove-Item -Path $folder -Recurse -ErrorAction Stop }
catch { "Without -Force: Failed. $($_.Exception.Message)" }
Remove-Item -Path $folder -Recurse -Force
"With -Force: Settings still there = $(Test-Path -Path $folder)"
Output:
Without -Force: Failed. You do not have sufficient access rights to perform this operation or the item is hidden, system, or read only.
With -Force: Settings still there = False
PowerShell 7 adds “or the item is hidden, system, or read only” to the message, which 5.1 leaves out.
-Force can’t override NTFS permissions, though. If you ge