January 3rd, 2002, 10:00 PM
Creating tar file
Can someone help me with the correct command line to create a recursive tar.gz file on a directory structure??
January 3rd, 2002, 11:30 PM
"man tar" for all the options.
tar cvf poop.tar /poop ; gzip poop.tar
tar cvfz poop.tar.gz /poop
Last edited by Hero Zzyzzx; January 3rd, 2002 at 11:33 PM.
January 4th, 2002, 01:39 AM
tar -zpscf tarfilename.tar.gz directory/*
Here's a Perl script that will create a recursive tarfile, and name it with the date and time embedded in the filename. I usually place it in /usr/local/bin. Just call it while adjacent to the directory you want to archive, using the directory name as the argument:
$dir_in =~ tr/\///d;
print "Archiving $dir_in/* ...\n";
use POSIX qw(strftime);
$now_string = strftime "%m-%d-%Y_%H%M", localtime;
$execstring="tar -zpscf ".$tarname." ".$dir_in."/*";
#print($execstring); # uncomment to debug
January 6th, 2002, 07:33 PM
Hey there thanks for the posts..... I found that the
tar cvf poop.tar /poop works for me however some of the files in the tar file have not recorded the directory the files have come from.. is there an easy way to fix this? does it have something to do with the size of the archive file? etc etc.....
what is the command to exclude a directory from the archive??
April 10th, 2002, 10:50 AM
do not forget that the output tar file should be is other directory