Re: Weird behavior with find command when tarring files
Date: Wed, 5 Dec 2018 19:38:10 -0800
Message-ID: <CAORjz=NJnym05uq141nM8hh=bbhV1y+Tv4tmeJ9=-rmrtoHd1g_at_mail.gmail.com>
> Thanks for the tip, I didn’t know about -print0. Is this option generally
> available on older Unix (hpux, aix, solaris)? I have been using double
> quotes in most of my code for a couple years around file variables in
> anticipation of being able to run on Windows environments. Have not dare
> tested that yet however.
>
>
>
> One other thing to note here. Be really careful with xargs. I believe it
> executes on null input too. I don’t recall the exact issue but I have been
> burned at least twice and good enough to recall you need to be very careful
> with it if you are deleting or modifying things. Also stay away from “find
> .” and make sure you try to use a full path there. This is all obvious
> maybe and only used here for the sake of examples but throwing it out there
> for the newbies if any are reading.
>
>
>
> Ethan Post
>
> https://www.linkedin.com/in/ethanraypost/
>
> https://arclogicsoftware.com
>
> https://twitter.com/poststop
>
>
>
>
>
> *From:* oracle-l-bounce_at_freelists.org <oracle-l-bounce_at_freelists.org> *On
> Behalf Of *Jared Still
> *Sent:* Friday, October 26, 2018 1:49 AM
> *To:* Hameed, Amir <Amir.Hameed_at_xerox.com>
> *Cc:* oracle-l_at_freelists.org
> *Subject:* Re: Weird behavior with find command when tarring files
>
>
>
> In addition to the other fine comments, you should get in the habit of
> dealing with filenames that have spaces.
>
>
>
> It seems impossible to anymore to avoid this, as you don't always have
> control over it.
>
>
>
> Here's how: use the '-print0' option for find, and the '-0' option for
> xargs.
>
>
>
> find . type f -mmin +239 -print0 | xargs -0 tar -cvf /tmp/test.tar
>
>
>
>
>
>
> Jared Still
> Certifiable Oracle DBA and Part Time Perl Evangelist
>
> Principal Consultant at Pythian
>
> Pythian Blog http://www.pythian.com/blog/author/still/
>
> Github: https://github.com/jkstill
>
>
>
>
>
> --
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist
Principal Consultant at Pythian
Pythian Blog http://www.pythian.com/blog/author/still/
Github: https://github.com/jkstill
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Dec 06 2018 - 04:38:10 CET