Author: | Marc 'BlackJack' Rintsch |
---|---|
Contact: | marc@rintsch.de |
Date: | 2005-08-26 15:15:22 +0200 (Fri, 26 Aug 2005) |
Version: | 0.3 |
Revision: | 755 |
Copyright: | This document has been placed in the public domain. |
rtar.py -- an archiver.
rtar.py [-h|--help|--version] rtar.py [options] file(s)
The program creates compressed tar archives from files and directories. In contrast to the original tar it builds a list of file names first and sorts it in a way that (should) give a better compression ratio.
It also makes the common task of archiving one directory a bit easier by providing a short option that infers the file name of the archive from the name of the directory and the compression algorithm. See Examples for details.
Way back in the old DOS days the RAR archiver had, and still has, three advantages over ZIP archives when it comes to compression ratio:
With tar archives 1. is true if bzip2 compression is used and 2. is always true as a tar archive is created first and then compressed as a whole.
But the grouping by file name extensions is not done by the standard tar programs. This is what rtar.py is doing.
The script requires Python 2.4 or higher.
--version show program's version number and exit -h, --help show this help message and exit -o FILENAME, -f FILENAME, --file=FILENAME write archive to this file instead of STDOUT. -a, --auto-name infer archive file name from the first given directory name. This only works if there is just one directory name given as argument. The archive is named: <directory_name>.tar[.<algorithm>] --list just dump the sorted file names to STDOUT -- don't create archive. --compression=ALGORITHM select compression algorithm from none, gzip or bzip2. [bzip2] -z, --gzip use gzip compression. -j, --bzip2 use bzip2 compression. [default] -b BLOCKS, --blocking-factor=BLOCKS BLOCKS x 512 per record [20]
Compress the contents of directories and all their subdirectories:
rtar.py foo/ > foo.tar.bz2 rtar.py -o foo_and_bar.tar.bz2 foo/ bar/
Create the archives foo.tar.bz2 and bar.tar.gz with the auto naming option:
rtar.py -a foo/ rtar.py --auto-name --gzip bar/
Added -b/--blocking-factor option. Setting it to 1 prevents some blocks full of zero bytes to be appended to the archive. May save some bytes, but generally those blocks are compressed very effectivly anyway.
The program does not crash anymore if it comes across files that can't be read. A warning is printed instead.
Directories given at the command line are archived now too. Before this fix only the contents of the directory were archived but not the top level directory name itself.
Fixed a really stupid bug that made creating archives with redirecting the output into a file impossible.
While compressing each file name is written to stderr and prefixed with the percentage of files already processed.
The user can select the compression algorithm (none, gzip or bzip2) and the auto naming feature (-a) was implemented.
Copyright © 2005 Marc 'BlackJack' Rintsch <marc@rintsch.de>
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.