'find' and 'tar' combination | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

'find' and 'tar' combination

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-06-2008
kharen11 kharen11 is offline
Registered User
 
Join Date: Mar 2007
Last Activity: 6 February 2008, 7:18 AM EST
Location: Manila
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
'find' and 'tar' combination

I'm trying to tar the files I get from the 'find' command result. However I can't make it run successfuly? This is for our archiving process.

Here is my script:
find /mnt/LOGS -mtime -10 -name "TUXLOG.*" -exec tar -cvf /mnt/LOGS/combine.tar {} \;

Im not sure why it is not working or it is even possible to use the 'tar' command with exec.

Appreciate your help.
Sponsored Links
    #2  
Old 02-06-2008
V3l0 V3l0 is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 10 April 2008, 10:18 AM EDT
Location: Belgium & France
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
You command "find /mnt/LOGS -mtime -10 -name "TUXLOG.*" -exec tar -cvf /mnt/LOGS/combine.tar {} \;" with the "-c" recreate for each file founded par find another "combine.tar".

Better way to create a temporay file :

Code:
find /mnt/LOGS -mtime -10 -name "TUXLOG.*" > combine.lst
tar -cvf /mnt/LOGS/combine.tar -L combine.lst

WARNING: If /mnt/LOGS/combine.tar already exists, you must use "tar -uvf" ...
Sponsored Links
    #3  
Old 02-06-2008
kharen11 kharen11 is offline
Registered User
 
Join Date: Mar 2007
Last Activity: 6 February 2008, 7:18 AM EST
Location: Manila
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
The -uvf works!!

Thank you so much...
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Complex find and replace only 1st instance string with dynamic combination SilvesterJ Shell Programming and Scripting 5 10-01-2011 07:08 AM
help with awk for file combination yanglei_fage Shell Programming and Scripting 9 04-26-2011 01:42 PM
combination between || and && in IF condition with ksh islam.said Shell Programming and Scripting 2 02-15-2010 08:09 AM
Grep and find combination nervous UNIX for Dummies Questions & Answers 5 10-08-2008 05:21 AM
Combination of find -xargs & wc -l mr_bold UNIX for Dummies Questions & Answers 4 07-08-2008 05:07 AM



All times are GMT -4. The time now is 07:41 AM.