Goes through a directory and searches for files older than a specific date and deletes them
Simply 'walks' through the specified folder and deletes files (recursively) that are older than the specified date.
- os module
- sys module
- sh module
- datetime module
The script uses Python3. You'll find the 'path' variable about halfway through the file. Edit it to the correct path, and then run the script. Best used as a cron job. This script will want to write to an error log called 'autodelete.log', and it will try to place said log in /var/log/. You can edit this, but make sure that you either run the script as root (preferably with `sudo`) or use `chmod` so that the log file is writable.
git clone https://www.ericlagerg/autodelete
`mv /path/to/autodelete/autodelete.py /where/you/want/the/script`
`sudo python3 ./autodelete.py`
OR `touch /var/log/autodelete.log && chmod 666 autodelete.log`