Fork me on GitHub


Reclaim your disk space. Clean up logs and old files safely. Preview changes before running. Written in 100% python.


Sick of remembering arcane find syntax to remove your logfiles? Use springclean, 100% free and (should) run wherever python can!


  • Select file based on name, age or both
  • Preview changes - confirm before running
  • Find how much disk space has been freed
  • Gzip, move to another directory or remove your files
  • Create an audit trail with syslog


# List all files that match regex .*.log$ :
springclean -x ".*\.log$"

# Remove all files that match mail.log
springclean -f mail.log --rm

# Gzip all files older than 7 days with confirmation
springclean --gzip --older 7d --confirm

# Move all files newer than 2 weeks to directory /tmp
springclean --newer 2w --mv --destdir /tmp

# List all files newer than 3 days in /tmp directory
springclean --dir /tmp --newer 3d --list

# Move all files older than 2 hours matching "*.log" to /tmp
springclean --mv -f "*.log" --older 2h --destdir /tmp

Usage [options]


Match options - can choose a file match and time option

-f MATCH, --filematch=MATCH
                      shell-style wildcard to match logfiles to process
-x MATCHRE, --matchre=MATCHRE
                      regex to match logfiles to process
                      match files newer than x units (d|h|m|s), eg 3d
                      match files older than x units (d|h|m|s), eg 3d

Actions - choose one (defaults to list)

--rm                  removed matched files
-l, --list            list matched files (default action)
-g, --gzip            gzip matched files
--mv                  move matched files to --destdir
--destdir=DESTDIR     directory to move files to (with --mv)

Switches - optional

-h, --help            show this help message and exit
--dir=DIR             directory to match from (default $PWD)
-v, --verbose         verbose output
-c, --confirm         confirm each individual operation (rm|gzip|mv)
-s, --syslog          log successful actions to syslog


Note: unless you have disabled shell wildcard expansion (with set -f) you should quote your wildcards.

What springclean does not do:
  • recurse into subdirectories (yet)
  • remove directories

To install:

  • Get the zip file from the link above
  • Unzip and copy springclean to somewhere in your path (eg /usr/local/bin or ~/bin/)

Or get the bleeding edge version from GitHub

Written by James Powell

Built with the assistance of Python, IntelliJ, GNU Emacs & Twitter Bootstrap