I’m a stickler for keeping things nice and tidy (often to my detriment!). As with most people the downloads folder on my PC is a bit of a dumping ground and I was forever deleting the contents of it….the same goes for emptying my recycle bin. I’m always looking to automate things to save me some clicks so spent some time writing a script in PowerShell that does these very two things!
- Deletes EVERYTHING in the Downloads folder within my user profile
- EMPTIES the Recycle Bin
Below is the script, which I saved as Clean.ps1
Remove-Item -Path C:\Users\brendan\Downloads\* -Confirm:$false -Recurse
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
If you are as equally sad as me and would like to use this, you’ll need to update the file path to point towards your downloads folder, which should be as simple as replacing “brendan” with your username.
I also created a batch file that I can run that then executes this PowerShell script for me (that way I can simply right-click the batch file to execute the PowerShell script). To use this update the file path to point it towards the location of the Clean.ps1 PowerShell script.
PowerShell -noprofile -executionpolicy bypass -command "&'D:\Clean.ps1'"
I saved the batch file as Clean.bat and saved to my desktop, where I can run it until my heart is content ๐.

Leave a comment