Skip to content
This repository was archived by the owner on Apr 10, 2021. It is now read-only.

ericlagergren/autodelete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

autodelete

Goes through a directory and searches for files older than a specific date and deletes them

Overview:

Simply 'walks' through the specified folder and deletes files (recursively) that are older than the specified date.

Instructions:

Requires:

  • 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.

To Install:

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`

About

Goes through a directory and searches for files older than a specific date and deletes them

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages