LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-11-2010, 11:17 PM   #1
lakshan
LQ Newbie
 
Registered: Aug 2003
Location: Sri Lanka
Posts: 28

Rep: Reputation: 15
Smile How to tar a list of files


Hi all,

I have some files located in /vol0/archives that has several files
Eg:- arch_00001.arc , arch_00002.arc, arch_00003.arc

I want to tar each of those files into separate tar ball by taking it garbing it from file name sequence,
Eg:- arch_00001.arc.tar.gz , arch_00002.arc.tar.gz, arch_00003.arc tar.gz

how do I define the tar command to go get those files and tar each file separately, As I mention above

Can some one help re this please


Lakshan
 
Old 02-11-2010, 11:21 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Something like this?
Code:
!/bin/sh

cd /vol0/archives
for i in *.arc; do
  echo "making tar of $i..."
  tar cvzf /archive_dir/${i}.tgz $i
done
echo "Done: `date`."
 
Old 02-11-2010, 11:41 PM   #3
lakshan
LQ Newbie
 
Registered: Aug 2003
Location: Sri Lanka
Posts: 28

Original Poster
Rep: Reputation: 15
Thumbs up

thanks paulsm4, thanks a lot
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
More tar issues - listing files in a single tar from a multivolume borks Thymox Linux - Software 4 09-23-2009 07:48 PM
untar a list of tar files? Rotwang Linux - General 6 10-10-2006 01:34 PM
How to list the files in my tar.bz2 archive ??? merlin23 Linux - Newbie 13 12-14-2004 08:50 AM
list files in a tar.gz file linuxtesting2 Linux - Newbie 4 09-23-2004 02:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration