KeyRoutines
StepFreefile.recycle

Delete old files to the Recycle Bin automatically

Delete to Recycle Bin removes one item, or every item in a folder that matches a name pattern, by putting it in the Recycle Bin. It is the safe way to automate clean-ups because nothing is gone for good.

How it works

  • Give it a single file or folder, or a folder plus a pattern like *.tmp to delete only matching items inside it.
  • Add an age so only items last changed at least that long ago go, and optionally include subfolders and matching folders.
  • Each deleted item is recorded, so Undo file moves on the run's page brings it back from the Recycle Bin.
  • Files open in another app are skipped and counted, so one locked file doesn't stop the clean-up.
  • An advanced switch deletes permanently instead; KeyRoutines asks you once, the first time it really runs, and deletes nothing without a yes.

Routines that use it

Clear old temp files

Every evening, delete *.tmp files older than a day from your Downloads folder.

Prune old screenshots

Once a week, send screenshots older than 30 days to the Recycle Bin, then Show banner with how many went.

Tidy after unzipping

After Unzip file has extracted an archive, delete the original .zip so only the folder is left.

Settings

SettingWhat it does
PathThe file or folder to delete, or the folder to clean up when a name pattern is set.
PatternOnly items in that folder with these names, like *.tmp (keep empty to delete the item itself).
Older thanOnly items last changed at least this long ago.
Include subfoldersadvancedAlso look inside subfolders.
Include foldersadvancedAlso delete matching folders, not only files.
PermanentlyadvancedDelete for good instead of using the Recycle Bin. Can't be undone; KeyRoutines asks you once.

Good to know

  • Only works on fixed local drives; network and removable drives have no Recycle Bin.
  • Permanent deletes can't be undone.
  • Hidden and system files are never chosen by a pattern.

Questions

How do I automatically delete old files in a folder on Windows 11?
Use Delete to Recycle Bin with the folder, a name pattern and an "older than" age, then run it on a schedule. Matching files go to the Recycle Bin, so you can restore them.
Can I get deleted files back?
Yes, unless you turned on permanent delete. Open the run and use Undo file moves, or restore them from the Recycle Bin as usual.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.