Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-31-2009
ahSher ahSher is offline
Registered User
 
Join Date: Mar 2009
Last Activity: 11 June 2009, 9:39 PM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all,

4 files are returned when i issue 'find . -mtime -1 -type f -ls'.
./ora_475244.aud
./ora_671958.aud
./ora_934052.aud
./ora_934050.aud

However, when I issued the below command:

tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file - ora_475244.

Why is it so? Please help. Thks!
Sponsored Links
    #2  
Old Unix and Linux 04-01-2009
zaxxon's Unix or Linux Image
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 20 October 2017, 2:49 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,575
Thanks: 176
Thanked 560 Times in 481 Posts
Basically it should be no problem. Maybe depending which version of tar you use. I am on Debian using GNU tar for this example:

Code:
$> find . -type d -name "dir[0-9]"
./dir1
./dir2
$> tar cvf bla.tar `find . -type d -name "dir[0-9]" -print`
./dir1/
./dir1/subdir1/
./dir1/.ssh/
./dir1/.ssh/somekey
./dir1/subdir2/
./dir2/
./dir2/subdir1/
./dir2/subdir2/
$> tar tvf bla.tar
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/subdir1/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/.ssh/
-rw-r--r-- root/root         0 2009-03-30 11:35 ./dir1/.ssh/somekey
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/subdir2/
drwxr-xr-x root/root         0 2009-03-30 11:38 ./dir2/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir2/subdir1/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir2/subdir2/


Make sure that your is showing the files you want, ie. maybe write it like this

Code:
# 1st:
find . -mtime -1 -type f -print
# If output is the files you want, 2nd:
tar -cvf test.tar `find . -mtime -1 -type f -print`

Sponsored Links
    #3  
Old Unix and Linux 04-02-2009
ahSher ahSher is offline
Registered User
 
Join Date: Mar 2009
Last Activity: 11 June 2009, 9:39 PM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

Thanks for the reply. I managed to get all my files. It is due to the FTP mode i'm using. If i set to ascii, i will only retrieve 1 file. Setting the ftp mode to binary retrieves all the files.

Thanks!
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find -mtime query Rajat UNIX for Dummies Questions & Answers 1 07-09-2008 07:12 AM
Problem with find command when used with mtime arunkumar_mca UNIX for Dummies Questions & Answers 4 01-07-2008 11:37 PM
problem with find and mtime arunkumar_mca UNIX for Dummies Questions & Answers 4 11-05-2007 06:41 AM
find . -mtime topcat8 UNIX for Dummies Questions & Answers 1 04-26-2006 10:55 AM
find -mtime off by one day? ceanntrean UNIX for Dummies Questions & Answers 4 08-24-2005 07:46 PM



All times are GMT -4. The time now is 04:00 PM.