Skip to content
a log / file cleanup and processing commandline tool
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A log / file cleanup and processing commandline tool.

Written in Python 2. Tested in Python 2.6 on Redhat / Centos 6 and Python 2.7 on Ubuntu 12.10.

It should also work on Python 2.6/2.7 on Windows and MacOS X but is untested.

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


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


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
Something went wrong with that request. Please try again.