|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Creating tar file
Howdy,
Can someone help me with the correct command line to create a recursive tar.gz file on a directory structure?? Cheers |
|
#2
|
||||
|
||||
|
"man tar" for all the options.
or tar cvf poop.tar /poop ; gzip poop.tar or tar cvfz poop.tar.gz /poop Last edited by Hero Zzyzzx : January 3rd, 2002 at 10:33 PM. |
|
#3
|
|||
|
|||
|
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: myscript directory_name or myscript directory_name/ Code:
#!/usr/bin/perl -w
$dir_in=shift(@ARGV);
chomp($dir_in);
$dir_in =~ tr/\///d;
print "Archiving $dir_in/* ...\n";
use POSIX qw(strftime);
$now_string = strftime "%m-%d-%Y_%H%M", localtime;
$tarname=$dir_in."_".$now_string.".tar.gz";
$execstring="tar -zpscf ".$tarname." ".$dir_in."/*";
#print($execstring); # uncomment to debug
system($execstring);
print("\n");
__________________
The real n-tier system: FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL Amazon wishlist -- rycamor (at) gmail.com |
|
#4
|
||||
|
||||
|
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?? |
|
#5
|
|||
|
|||
|
do not forget that the output tar file should be is other directory
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Creating tar file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|