Empty the Recycle Bin with PowerShell (Clear-RecycleBin)

To clear the Recycle Bin with PowerShell, run Clear-RecycleBin. Add -Force so it doesn’t stop for confirmation, and remember that the files are gone for good:

Clear-RecycleBin -Force

Dana Reyes does IT support for an accounting firm in Seattle. The shared front-desk PCs fill their Recycle Bins with exported reports, and she wants a cleanup she can preview, limit and schedule.

In this tutorial, I’ll build that with you step by step. You’ll clear the Recycle Bin in PowerShell safely: measure it, preview with -WhatIf, empty one drive, remove only certain items and run it weekly.

I tested it in PowerShell 7.6 and 5.1 on Windows 11. My own bin holds files I’m keeping, so real deletions only touched three test files.

What the finished Recycle Bin cleanup does

Here’s the goal. The Remove-RecycleBinItem function we’ll write removes only items deleted from one folder, and -WhatIf lists them first:

. .\Remove-RecycleBinItem.ps1
Remove-RecycleBinItem -DeletedFrom 'C:\psfaqs\t\recyclebin\demo' -WhatIf

Output:

What if: Performing the operation "Permanently delete" on target "austin-sales-q3-2026.csv".
What if: Performing the operation "Permanently delete" on target "denver-invoices-2026.xlsx".
What if: Performing the operation "Permanently delete" on target "seattle-notes.txt".

Windows PowerShell 5.1 printed the same lines. First, though, we check what’s in the bin with Measure-Object in PowerShell.

Step 1: Check how much is in the Recycle Bin

Clear-RecycleBin doesn’t report anything, so measure first. The Shell.Application COM object opens the bin as special folder 10, and each item exposes its size:

$bin = (New-Object -ComObject Shell.Application).Namespace(10)
$items = @($bin.Items())
$bytes = ($items | ForEach-Object { $_.ExtendedProperty('Size') } | Measure-Object -Sum).Sum
'{0} items, {1:N1} MB in the Recycle Bin' -f $items.Count, ($bytes / 1MB)

Output:

35 items, 1,001.1 MB in the Recycle Bin
Counting Recycle Bin items and size with Shell.Application namespace 10 in PowerShell 7
The item count and total size of the Recycle Bin (PowerShell 7)

That’s the real total on my test PC. ExtendedProperty(‘Size’) matches Explorer; the plain Size property came out smaller. For other formats, see rounding to 2 decimal places.

Step 2: Send test files to the Recycle Bin

Practice on throwaway files. Remove-Item deletes permanently, so send them to the bin with the VisualBasic class:

Add-Type -AssemblyName Microsoft.VisualBasic
[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile($path, 'OnlyErrorDialogs', 'SendToRecycleBin')

I sent three files from my test folder. This lists only the items whose original location is that folder:

$demo = 'C:\psfaqs\t\recyclebin\demo'
$bin = (New-Object -ComObject Shell.Application).Namespace(10)
@($bin.Items()) |
    Where-Object { $_.ExtendedProperty('System.Recycle.DeletedFrom') -eq $demo } |
    ForEach-Object {
        [pscustomobject]@{
            Name    = $_.ExtendedProperty('System.FileName')
            Deleted = $_.ExtendedProperty('System.Recycle.DateDeleted').ToString('yyyy-MM-dd')
            SizeKB  = $_.ExtendedProperty('Size') / 1KB
        }
    } | Sort-Object Name | Format-Table -AutoSize

Output:

Name                      Deleted    SizeKB
----                      -------    ------
austin-sales-q3-2026.csv  2026-10-19     48
denver-invoices-2026.xlsx 2026-10-19    120
seattle-notes.txt         2026-10-19      2
Listing Recycle Bin items deleted from one folder with name, date and size in Windows PowerShell 5.1
Three test files in the Recycle Bin with their deletion date and size (Windows PowerShell 5.1)

System.FileName keeps the extension, while the item’s Name hides it like Explorer does. Drop the Where-Object filter to list everything in the bin.

Step 3: Preview Clear-RecycleBin with -WhatIf

-WhatIf shows what the cmdlet would empty and deletes nothing. -DriveLetter accepts C or C: (or C:\):

Clear-RecycleBin -WhatIf
Clear-RecycleBin -DriveLetter C -WhatIf
Clear-RecycleBin -DriveLetter 'C:' -WhatIf

Output:

What if: Performing the operation "Clear-RecycleBin" on target "All of the contents of the Recycle Bin".
What if: Performing the operation "Clear-RecycleBin" on target "All of the contents of the Recycle Bin for the 'C:\' drive".
What if: Performing the operation "Clear-RecycleBin" on target "All of the contents of the Recycle Bin for the 'C:\' drive".
Clear-RecycleBin -WhatIf and -DriveLetter C preview in Windows PowerShell 5.1
-WhatIf previews emptying all drives or only drive C (Windows PowerShell 5.1)

PowerShell 7 printed the same lines. One warning from Microsoft Learn: -Force overrides -WhatIf, so never combine them for a test. That would empty the bin for real.

Step 4: Empty the Recycle Bin without the prompt

Clear-RecycleBin always asks first, even without -Confirm. That breaks scripts: in a non-interactive session there’s nobody to answer, and it fails before deleting anything: