Automatically deleting old files from recycling bin while keeping the new ones?



The Windows Recycle Bin is a very useful tool for recovering deleted files, however it can quickly become cluttered over time. You can manually delete old files from the Recycle Bin, but this can be time-consuming and tedious. Fortunately, there are several ways to automate the process of deleting old files from the Recycle Bin while keeping the new ones.

The first option is to use a Windows command-line tool called “Cleanmgr.exe”. This tool is included with all versions of Windows, and can be used to delete files from the Recycle Bin that are older than a specified number of days. To do this, open the Command Prompt and type the following command:

cleanmgr /sageset:n

This will open a dialog box where you can specify the number of days after which files should be deleted from the Recycle Bin. Once you have set the number of days, click “OK” and then type the following command:

cleanmgr /sagerun:n

This will delete all files from the Recycle Bin that are older than the number of days you specified.

Another option is to use a third-party tool such as CCleaner or Recuva. Both of these tools are available for free and can be used to delete files from the Recycle Bin that are older than a specified number of days. They both also have additional features that allow you to customize the cleaning process to delete files based on size, type, and other criteria.

A third option is to use a script or batch file to automatically delete old files from the Recycle Bin. This is a more advanced option and requires some knowledge of scripting and batch files, but it is a very powerful way to automate the process of deleting old files.

To use a script or batch file to delete old files from the Recycle Bin, you first need to create the script or batch file. This can be done using any text editor such as Notepad. The script or batch file should contain the following commands:

FORFILES /P C:\\RecycleBin /S /M *.* /D - /C \cmd /c Del @file\

This command will delete all files from the Recycle Bin that are older than the specified number of days. You can replace the \\ with the number of days after which files should be deleted.

Once the script or batch file is created, it can be scheduled to run automatically using the Windows Task Scheduler. This can be done by going to “Control Panel > Administrative Tools > Task Scheduler”. Once there, click “Create Basic Task” and follow the instructions to create a task that runs the script or batch file at a specified time.

Using any of these methods, you can easily automate the process of deleting old files from the Recycle Bin while keeping the new ones. This can save you time and keep your Recycle Bin from becoming cluttered with unnecessary files.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo