zipping all the tar files to singlr file in directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers zipping all the tar files to singlr file in directory
# 1  
Old 01-06-2009
zipping all the tar files to singlr file in directory

Hi,

i have more than 300 tar files in directory and i want to zip all tar files to single file.

could anybody tell me the command since i know how to do zip for single tar file:

bash-3.00$gzip 2008_11_10.tar

bash-3.00$ pwd
/oracle1/archivebackup


in this directory i have lot files and i want to make single zip file.

Thanks

Prakash
# 2  
Old 01-06-2009
Code:
tar -cf - *.tar | gzip -c9 > everything.tar.gz

# 3  
Old 01-06-2009
That might deserve a little more explanation. gzip does not support multiple files, it's purely for stream compression. tar, on the other hand, does not compress, but is great at bundling files together into a stream while preserving all their attributes. This is why they are so frequently friends.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Making Tar of directory and tar file is going to be placed

Quick question, is it possible to make a Tar of completely directory and placing the tar file in it (will this cause even the tar file to tarred ?) sample: /opt/freeware/bin/tar -cvf - /oracle | gzip > /oracle/backup.tgz will the tar file backup.tgz also include backup.tgz ? i tried... (5 Replies)
Discussion started by: filosophizer
5 Replies

2. UNIX for Dummies Questions & Answers

Deleting a directory and zipping another directory

Hi Folks, I have a directory in unix that is /usr/local/pos contain the folowing directoreis ..that is dir1 dir2 dir3 now I want to delete only dir2 please advise how to remove the directory dir 2 ..that is rm command and how to use it , and second if I want to zip the dir3 please... (1 Reply)
Discussion started by: punpun66
1 Replies

3. Shell Programming and Scripting

zipping functionality (tar) not working as expected

Hi all, I here have an index file ($index) which lists the full paths of some files, and am tying to use "tar" to zip all of them. I ran a command like below, cat $index | xargs tar -rcf $archived_file Strangely I noticed only part of files in that index were zipped in my... (4 Replies)
Discussion started by: isaacniu
4 Replies

4. UNIX for Dummies Questions & Answers

tar files in directory

can someone give me a script to tar files that is older than 5 days in a directory that is not something like this: fileArray=($(find -mtime +5 asdfasdf)) tar -cvf asfadfasdfa ${fileArray} as the Unix I'm using has some problem with ($( )), I need another way to tar files in the folder.... (1 Reply)
Discussion started by: s3270226
1 Replies

5. UNIX for Advanced & Expert Users

How to rsync or tar directory trees, with hidden directory, but without files?

I want to backup all the directory tress, including hidden directories, without copying any files. find . -type d gives the perfect list. When I tried tar, it won't work for me because it tars all the files. find . -type d | xargs tar -cvf a.tar So i tried rsync. On my own test box, the... (4 Replies)
Discussion started by: fld2007
4 Replies

6. Shell Programming and Scripting

Zipping of file in a different directory

Hi, I am having some problem with a shell script which zip some files. For zipping I have used the following command: find . -name "Test_*" -mtime 0 | zip Test_$(date +"%Y%m%d") -@ I have kept the script in /home/abc directory. It is creating the zip file within the same directory where i... (2 Replies)
Discussion started by: abhishek_510
2 Replies

7. Shell Programming and Scripting

zipping a directory when the file count is over $X

Hiya, I've been plugging away at this script and I cant get it to behave as I need. first off it fails to adhere to the conditions of the file limit, and zips the directory regardless of the file count and secondly, but less important it zips up the entire path not just the directory I'm... (2 Replies)
Discussion started by: orionrush
2 Replies

8. Shell Programming and Scripting

Add directory to TAR file whitout files.

Hi, What I'm trying to do is rather easy to explain, but I don't know if it's possible. The main idea is that I have directories which I want to add to a TAR file, but for some of them I don't want to include the files in the directory. I just want to add the path to the TAR file as if the... (5 Replies)
Discussion started by: wisobe
5 Replies

9. UNIX for Dummies Questions & Answers

extract tar files without creating directory

I received a tar file of a directory with 50,000 files in it. Is it possible to extract the files in the tar file without first creating the directory? ie. Doing tar -xvf filename.tar extracts as follows: x directory/file1.txt x directory/file2.txt . . . I would like to avoid... (4 Replies)
Discussion started by: here2learn
4 Replies

10. UNIX for Dummies Questions & Answers

tar'ing and zipping files

If I have a directory /directory1 and want to tar and zip everything in it into a file new_tar.tar.gz on disk (not tape) How can I do it? I tried tar -cv /new_tar.tar /directory1/* But I got an error: tar: /dev/rmt/0: No such device or address (4 Replies)
Discussion started by: FredSmith
4 Replies
Login or Register to Ask a Question