A Program to Help Cleaning your Directories

Author(s): Manuel Carro.

A simple program for traversing a directory tree and deciding which files may be deleted in order to save space and not to loose information.

Usage (cleandirs)

cleandirs [--silent] <initial_dir> <delete_options> <backup_options>
cleandirs explores <initial_dir> (which should be an absolute path)
and looks for backup files and files which can be generated from other
files, using a plausible heuristic aimed at retaining the same amount
of information while recovering some disk space.  The heuristic is
based on the extension of the filename.

Delete options is one of:
   --list: just list the files/directories which are amenable to be deleted,
           but do not delete them. SAFE.
    --ask: list the files/directories and ask for deletion. UNSAFE if you
           make a mistake.
 --delete: just delete the files/directories without asking.  I envy your
           brave soul if you choose this option.

Backup options is one of:
 --includebackups: include backup files in the list of files to check.
 --excludebackups: do not include backup files in the list of files
                   to check.
    --onlybackups: include only backup files in the list of files to check.

Symbolic links are not traversed.  Special files are not checked.


Invoking the program with no arguments will return an up-to-date information on the options.

Known bugs and planned improvements

  • Recursive removal of subdirectories relies on the existence of a recursive /bin/rm command in your system.