Portable Python Utilities

Command line

cmp.py

Compare two files.

Usage:

cmp.py file1 file2

remove-old-files.py

Remove old files. It’s a portable replacement for find start_dir -type f -mtime +31 -delete.

Usage:

remove-old-files.py [-e] -o days start_dir

Options:

-e, --empty-dirs
                       remove empty directories
-o days, --older days
                       remove files older than this number of days;
                       this is a required option

rm.py

Remove files.

Usage:

rm.py file1 [file2...]

which.py

Find a program in PATH and print full path to it.

Usage:

which.py program

Indices and tables