[Tutor] writing sample program that zips files and saves in a backup directory

Eike Welk eike.welk at gmx.net
Tue Oct 13 22:45:03 CEST 2009

Hello David!

This is meant as an addition to Kent's remarks that 'gzip' is 
inappropriate, and you should use tar to create the archive. 
The 'tar' program can additionally use 'gzip' to compress the 
archive. A useful command would be:

tar cvzf archive_name.tgz file_or_dir_1 file_or_dir_2 and_so_on

tar czf .... does not print the filenames.

See the manpage here:

Ahem... I'm assuming that Mac OS X uses GNU tar, and not some other 
version of the program. In this case you must read its manpage and 
maybe need to use a pipe:
tar c all_files_of_the_archive | gzip > archive_name.tgz

Kind regards,

More information about the Tutor mailing list