Re: Weird behavior with find command when tarring files

From: Dave Herring <gdherri_at_gmail.com>
Date: Mon, 22 Oct 2018 12:03:15 -0500
Message-ID: <CAFN=diCON7Dok3QnnO4U+tzMc+6nr9ctBPCWQ++N_5-sb4ydzg_at_mail.gmail.com>



Amir, I'd go with:

% tar cvf /tmp/test.tar `find . type f -mmin +239 -print` | tee test.log

% wc -l test.log

% tar tvf /tmp/test.tar | wc -l

Lines 2 and 3 will help in verification, in case you don't trust the tar command. "tee" is used to you can watch output and save it as well.

Dave

On Sat, Oct 20, 2018 at 8:02 PM Hameed, Amir <Amir.Hameed_at_xerox.com> wrote:

> I appreciate for all the feedback that I have received. It helped me
> resolved the issue.
>
>
>
> Thanks
>
> *From:* Stefan Knecht <knecht.stefan_at_gmail.com>
> *Sent:* Friday, October 19, 2018 2:29 AM
> *To:* Hameed, Amir <Amir.Hameed_at_xerox.com>
> *Cc:* oracle-l-freelists <oracle-l_at_freelists.org>
> *Subject:* Re: Weird behavior with find command when tarring files
>
>
>
> Use tar -r instead of tar -c
>
>
>
> It will create the archive if it doesn't exist and append to it if it
> does. Your call to tar -c will probably overwrite the file each time it
> runs.
>
>
>
> On Fri, Oct 19, 2018 at 3:58 AM Hameed, Amir <Amir.Hameed_at_xerox.com>
> wrote:
>
> Hi,
>
> I am using the *find* command to TAR up files that are older than 4 hours:
>
>
>
> find . type f -mmin +239 | xargs tar -cvf /tmp/test.tar
>
>
>
> The command tars up files and seems to finish fine. However, when I untar
> and count the number of files against the count of files that should have
> been captured (find . type f –mmin +239 | xargs ls –l | wc -l) there is a
> huge difference and the files captured by tar were way less than the file
> listed for the same time.
>
>
>
> This is a strange behavior. What am I doing wrong (I am sure I am doing
> something wrong)?
>
>
>
>
>
> Thanks,
>
> Amir
>
>
>
>
>
>
>
>
> --
>
> //
>
> zztat - The Next-Gen Oracle Performance Monitoring and Reaction Framework!
>
> Visit us at zztat.net | _at_zztat_oracle | fb.me/zztat | zztat.net/blog/
>

-- 
Dave

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Oct 22 2018 - 19:03:15 CEST

Original text of this message