To automatically delete files older than 90 days, you can set up a scheduled task or script depending on your operating system. Here are common solutions for Windows, macOS, and Linux:
Windows (Using PowerShell + Task Scheduler)
-
PowerShell Script:
-
Set Up Task Scheduler:
-
Open Task Scheduler → Create Basic Task.
-
Choose a trigger (e.g., Daily).
-
Select “Start a program” → Browse and select PowerShell.
-
Add arguments:
-
Linux/macOS (Using a Cron Job)
-
Shell Command:
-
Add to Cron:
-
Run
crontab -eand add: -
This runs daily at 2 AM.
-
Notes:
-
Replace
/path/to/folderorC:PathToFolderwith your actual folder path. -
Test scripts on sample directories first to prevent accidental data loss.
Share this Page your favorite way: Click any app below to share.