bzip2
Warren Togami
warren at togami.com
Sat Nov 24 20:13:16 PST 2001
On Sat, 2001-11-24 at 18:04, Rodney K wrote:
> Is there a way to bzip a directory? I don't see any options for doing
> directories in the help menu.
>
> Thanks,
> Rodney
bzip2 works exactly like gzip. It will only compress a single file.
What you want is to create a tar file, but use bzip2 to compress instead
of gzip. You could tar before compressing, but tar has built in gzip
and bzip2 so you can use it directly. Here is a little demonstration.
[warren at videl temp]$ pwd
/home/warren/temp
[warren at videl temp]$ ls -l
total 4
drwxrwxr-x 2 warren warren 4096 Nov 24 18:08 stuff
[warren at videl temp]$ ls -l stuff/
total 0
-rw-rw-r-- 1 warren warren 0 Nov 24 18:08 1.txt
-rw-rw-r-- 1 warren warren 0 Nov 24 18:08 2.txt
-rw-rw-r-- 1 warren warren 0 Nov 24 18:08 3.txt
[warren at videl temp]$ tar cfvj archive.tar.bz2 stuff/
stuff/
stuff/1.txt
stuff/2.txt
stuff/3.txt
[warren at videl temp]$ tar cfvz archive.tar.gz stuff/
stuff/
stuff/1.txt
stuff/2.txt
stuff/3.txt
[warren at videl temp]$ ls -l
total 12
-rw-rw-r-- 1 warren warren 173 Nov 24 18:10 archive.tar.bz2
-rw-rw-r-- 1 warren warren 168 Nov 24 18:11 archive.tar.gz
drwxrwxr-x 2 warren warren 4096 Nov 24 18:08 stuff
In order to uncompress the archives simply replace 'c' with 'x' to
extract rather than create the archive.
tar xfvz archive.tar.gz
tar xfvz archive.tar.bz2
bzip2 has much greater compression than gzip, but it is also
considerably slower.
More information about the LUAU
mailing list