ThisCalculator

Everyday

Empty Recycle Bin Command Line: Windows and Mac

Updated · Standard formula, shown below

Empty Recycle Bin Command Line: Windows and Mac

To empty the Recycle Bin from a command line, Windows users can use PowerShell’s Clear-RecycleBin command; macOS and Linux use different Trash folders and commands. The safest method depends on your operating system and whether you want confirmation before deleting anything permanently.

Windows: Empty the Recycle Bin with PowerShell

Open PowerShell and run:

Clear-RecycleBin

PowerShell normally asks you to confirm the operation. To empty the bin without a prompt, use:

Clear-RecycleBin -Force

The command empties the Recycle Bin for the current user. It does not provide a convenient way to restore the deleted files afterward, so check the bin first if there is any chance you may need something in it. The -Force option suppresses confirmation; it does not make the deletion reversible.

To target a particular drive, specify its drive letter, for example:

Clear-RecycleBin -DriveLetter C

To clear that drive without a confirmation prompt:

Clear-RecycleBin -DriveLetter C -Force

Use a drive letter without a colon. If you want to empty multiple drives, run the command once for each drive, or omit -DriveLetter to act on the current user’s Recycle Bin across available drives.

Using Command Prompt Instead

Clear-RecycleBin is a PowerShell cmdlet, not a traditional Command Prompt command. You can run it from Command Prompt by launching PowerShell with the command, for example:

powershell.exe -NoProfile -Command "Clear-RecycleBin -Force"

This starts Windows PowerShell, runs the cmdlet, and exits. On systems where PowerShell 7 is installed as pwsh, you can use pwsh in place of powershell.exe. The classic Command Prompt command del deletes specified files, but it is not a safe or reliable substitute for emptying the Recycle Bin: the bin uses special per-drive storage and metadata.

For a script, scheduled task, or administrative workflow, prefer the documented cmdlet over deleting files inside the Recycle Bin’s storage directories. Directly removing those internal files can leave inconsistent contents or fail because of permissions and system protections.

What the Command Actually Deletes

When you delete a file normally in Windows, it may be moved to the Recycle Bin rather than immediately erased. The bin keeps information Windows needs to display the item and, while it remains there, restore it to its previous location. Emptying the bin removes those recoverable entries from the normal Windows interface.

Recycle Bins are associated with drives. A file deleted from one drive may be stored in that drive’s hidden Recycle Bin area, which is why the cmdlet offers a drive option. The command works within the current user’s context; running it as a different user may affect that user’s bin rather than the one you expected.

Emptying the bin is not the same as securely erasing every trace of the file’s data. On modern storage, deleted data may remain recoverable for some time, depending on the drive, file system, and later activity. If your goal is to protect sensitive information, simply emptying the bin is not a guarantee of secure erasure.

macOS and Linux: Their Trash Commands Differ

macOS does not have Windows’ Recycle Bin or PowerShell cmdlet. Deleted files normally go to a Trash folder in the user’s home directory, while removable or external volumes can have their own Trash locations. On many macOS installations, this command removes items from the current user’s home Trash:

rm -rf ~/.Trash/*

This is a destructive shell command. The -r option removes directories and their contents, and -f suppresses many prompts and errors. Carefully verify the path before pressing Enter; a typo or altered path can delete unrelated files. The command may not clear Trash contents stored on external volumes.

Linux desktop environments vary. Many follow the FreeDesktop.org Trash convention, commonly storing trashed files under ~/.local/share/Trash, with separate file and metadata directories. Removing the contents of those directories manually can empty that user’s Trash, but desktop tools and file managers may handle metadata and mounted volumes differently. Check the Trash location used by your desktop environment before running a recursive delete command. Avoid copying a Windows command onto macOS or Linux: the operating systems do not share the same bin implementation.

Safety Checks and Common Problems

  • Confirm the operating system and shell. Clear-RecycleBin belongs in PowerShell. A “command not found” message in Command Prompt, macOS Terminal, or Linux usually means the wrong command environment.
  • Review the bin before forcing deletion. Open the Recycle Bin or Trash and restore anything you might need. After emptying, recovery is uncertain and may require specialized tools.
  • Check the account. A command run under another Windows account may not empty the bin you see when signed in normally. Administrative elevation does not automatically mean the correct user’s bin is targeted.
  • Check drive selection. If items remain, they may belong to another drive or removable volume. Try specifying the relevant Windows drive letter, or empty that drive’s bin through its normal interface.
  • Do not delete internal bin folders casually. Windows protects some locations, and direct deletion can cause permission errors or inconsistent results. Use the cmdlet or graphical interface instead.
  • Understand that “empty” is not “securely erased.” The command removes items from the bin; it does not certify that no data can be recovered from storage.

Command Line or Graphical Interface?

The command line is useful when you need a repeatable action, are working through a script, or want to specify a drive. The graphical Recycle Bin is usually better when you want to inspect filenames, restore selected items, or avoid accidentally emptying the wrong contents. Both approaches perform a normal empty-bin operation; neither should be treated as a secure-wipe procedure.

For an occasional cleanup, opening the bin and choosing its empty option is often the clearest choice. For automation, use Clear-RecycleBin and be cautious about adding -Force, especially in scripts that run unattended.

Frequently Asked Questions

What is the command to empty the Recycle Bin in Windows?
In PowerShell, run Clear-RecycleBin. Add -Force to skip confirmation, or use -DriveLetter C to target drive C.

Can I empty the Recycle Bin from Command Prompt?
Yes. Start PowerShell from Command Prompt with powershell.exe -NoProfile -Command "Clear-RecycleBin -Force". The actual Recycle Bin command is still a PowerShell cmdlet.

Does Clear-RecycleBin empty every user’s bin?
It acts in the context of the user running it; do not assume it clears every Windows account’s Recycle Bin. Run it under the intended account and check the result.

How do I empty the Recycle Bin on a specific drive?
Use Clear-RecycleBin -DriveLetter D, replacing D with the drive letter. Add -Force only if you are sure you do not need a confirmation prompt.

Is an emptied Recycle Bin permanently unrecoverable?
No. Emptying removes items from the normal bin and makes ordinary restoration unavailable, but it does not guarantee that the underlying data has been securely erased or cannot be recovered.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.