The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding Multiple Lines to Multiple Files dayinthelife Shell Programming and Scripting 2 06-04-2008 08:50 AM
Splitting input files into multiple files through AWK command arund_01 Shell Programming and Scripting 3 05-13-2008 06:17 AM
Multiple search in multiple files maxvirrozeito Shell Programming and Scripting 2 12-13-2007 10:32 AM
when I try to run rm on multiple files I have problem to delete files with space umen UNIX for Dummies Questions & Answers 1 09-20-2005 12:20 AM
Searching multiple files with multiple expressions Anahka Shell Programming and Scripting 6 01-07-2004 03:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-02-2006
Registered User
 

Join Date: Oct 2005
Posts: 18
Tar multiple files

Hi All,

There 2 files in the folder /temp/tst/
1.txt
2.txt

When I run the command

find /temp/tst \( -name "*.txt" \) -exec tar cf /temp/123.tar {} \;

it creates the tar file 123.tar with only one file in it and that is 2.txt.But if I use the command

find /temp/tst \( -name "*.txt" \) -exec tar cf /temp/123.tar {} + 1>/dev/null

it creates both the files in the 123.tar file which is what I want.

But I don't understand why is this happening.

Any comments experts?

Last edited by rony_daniel; 10-02-2006 at 05:31 PM.
Reply With Quote
Forum Sponsor
  #2  
Old 10-02-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 989
The + tells find to only run it once. It runs it like "tar -cf file.tar file1 file2", which includes both files in one archive, file.tar.

The version without the + runs tar twice, once for each file. tar does not automatically append, it replaces, so it replaces the first archive.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0