Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tar multiple files

Status
Not open for further replies.

hok1man

Technical User
Feb 16, 2008
102
Hi guys,

I'm trying to tar up *.ksh, but not successful, the files are in different directory and in different level dir.

so this is what I tried :
find . -name "*.ksh" -exec tar -cf script.tar {} \;

but doesn't work..
the content of script.tar is the last file of the ksh list files..

any suggestion?
 
I'd use this:
Code:
tar -cf script.tar $(find . -name '*.tar')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Or if there are a massive number of ksh scripts:

Code:
find . -name '*.ksh' | tar -cfI scripts.tar -

The -I option depends on your OS - that one is valid for Solaris. -T or --files-from= are the Linux equivalents. On AIX it's -L... crazy!

Annihilannic.
 
Thanks guys,

Anni,
are you sure without xargs??
find . -name '*.ksh' | xargs tar -cfI scripts.tar -
 
Using xargs you may launch several tar process and thus get incomplete archive ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top