Skip to main content

GarbageTruck

https://img.shields.io/pypi/v/garbagetruck.svg https://img.shields.io/travis/bradrf/garbagetruck.svg Documentation Status Updates

A small tool to periodically move old files into the local file system trash.

Features

Use GarbageTruck to build and maintain scheduled cleanup of files in various directories that tend to collect files over time. GarbageTruck will send any files older than a relative period to the local file system trash using the current user’s crontab to schedule checks for old files from cron. This makes the utility safe in that any files moved to the trash could be restored simply without worrying about immediate loss (until the trash is emptied, of course).

For example, let’s say one never cleans out their downloaded files. Here’s how to set a GarbageTruck job to periodically move files older than six months into the trash:

$ garbagetruck set --older-than '6 months' --check-every day 'Clean out old downloads' ~/Downloads/

This will set up a schedule (using cron) to look for files each day that are older than three montsh and have them moved into the correct trash (courtesy of send2trash). The details can be shown like this:

$ garbagetruck -l debug list
[2016-09-03T15:55:32-0700 #31693] INFO     garbagetruck Job 57d1db0a8b8427c3041ac1af89b0a348: name="Clean out old downloads" dirs=["/Users/brad/Downloads"] files_older_than="3 months" check_every="day"
[2016-09-03T15:55:32-0700 #31693] DEBUG    garbagetruck * 1 * * * /Users/brad/.virtualenvs/garbage_truck/bin/garbagetruck run 57d1db0a8b8427c3041ac1af89b0a348 # GarbageTruck: Clean out old downloads

Each call to the set command will replace the same named job. Alternatively, if the job is no longer useful, remove it like this:

$ garbagetruck remove 'Clean out old downloads'

To check on a job, any problems and results will be logged to one of the following locations:

  • OS X will use ~/Library/Logs/garbagetruck.log.

  • Other systems will rely on what click_app_dir returns.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2016-09-02)

  • First release on PyPI.

Metadata

Release files for garbagetruck 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for garbagetruck 0.1.0
File Size Uploaded
garbagetruck-0.1.0.tar.gz 24.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for garbagetruck 0.1.0
File Interpreter ABI Platform
garbagetruck-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 34.2 kB

Release files / garbagetruck-0.1.0.tar.gz

Download URL garbagetruck-0.1.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bec7750203a78389f6ea31959c03fe1c2ebfc678593606dac02d792afcbf27ce
BLAKE2b-256 checksum
How to use checksums
09dbc76b81cd64a229b05ba91004dddef8259ca231d4e032b92b61cd7e7a529c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / garbagetruck-0.1.0-py2.py3-none-any.whl

Download URL garbagetruck-0.1.0-py2.py3-none-any.whl
Size 9.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ae7c33eba4b00c409420f6540ab9bf7da8e21c058a6516c61ec574c49c72fbde
BLAKE2b-256 checksum
How to use checksums
f1111f4964a43e2fd6b97244bf886b2a890dd57ccd2c1d22de3da8d92e2eba17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page