Here’s a Python script that allows you to mass-delete files based on their modification date. It recursively scans a given directory and deletes files older than a specified number of days or before a specific date.
Features:
-
days_old: Deletes files older than N days.
-
before_date: Deletes files before a specific date (overrides
days_old
). -
dry_run: Preview which files would be deleted before actual deletion.
How to Run:
-
Replace
"/path/to/your/folder"
with your actual directory. -
Set
dry_run=False
after testing to delete files.
Let me know if you need this adapted for file creation dates, only specific file types, or GUI-based execution.
Leave a Reply