The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Disk Usage in GB and Unix command to find the biggest file/folder manas6 UNIX for Dummies Questions & Answers 8 07-30-2008 04:54 AM
Problem using find and xargs quixote Shell Programming and Scripting 5 05-02-2008 07:24 PM
Usage find command raman1605 SUN Solaris 2 08-04-2007 10:45 PM
find command usage zp523444 UNIX for Advanced & Expert Users 1 11-28-2005 09:33 PM
find | xargs cat asal_email Shell Programming and Scripting 4 03-16-2005 09:16 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-19-2007
Registered User
 

Join Date: Jul 2007
Posts: 10
command usage on find with xargs and tar

my task : tar up large bunch of files(about 10,000 files) in the current directories that created more than 30 days ago
but it come with following error

find ./ -ctime +30 | xargs tar rvf test1.tar
tar: test1.tar: A file or directory in the path name does not exist.
Reply With Quote
Forum Sponsor
  #2  
Old 12-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
If the tar file does not exist you cannot update it!

So I would create the tar file first adding a single readme file describing what it contains, then do what you were going to do.

However, for sanities sake, use find to create the list of files, then you will have a record of what you were putting in the tar file, so if you need to move or delete them you can do so from that list.

Also, you don't want the tar file itself to be included.
Reply With Quote
  #3  
Old 12-23-2007
Registered User
 

Join Date: Jul 2007
Posts: 10
Quote:
Originally Posted by porter View Post
If the tar file does not exist you cannot update it!

So I would create the tar file first adding a single readme file describing what it contains, then do what you were going to do.

However, for sanities sake, use find to create the list of files, then you will have a record of what you were putting in the tar file, so if you need to move or delete them you can do so from that list.

Also, you don't want the tar file itself to be included.

thank for your reply, it work with your recommandation but it is kind of weird way to make it work in my mind.
Reply With Quote
  #4  
Old 12-25-2007
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
When you use find already, what do you need xargs for? Just a suggestion: use the -exec clause in find:

find . -ctime +30 -exec tar -rvf test1.tar {} \;

bakunin
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 06:38 PM.


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