Re: [SLUG] creating tar archive of filenames containing spaces

From: Eben King (eben01@verizon.net)
Date: Mon Apr 30 2007 - 20:26:50 EDT


>From: "Ian C. Blenke" <ian@blenke.com>
>Date: 2007/04/30 Mon PM 05:31:40 CDT
>To: slug@nks.net
>Subject: Re: [SLUG] creating tar archive of filenames containing spaces

>Very true. You can also use "--null" to accept null
>terminated names, ie:
>
> find . -print0 | tar cf ../test.tar -T - --null
>
>Which, like find -print0 and xargs -0, allows tar to
>accept a null terminated list of filenames.

Nifty.

>Not that I think you need --null there, as each
>filename is already on a separate line, right?

If you have mostly sane filenames, right, you don't need them separated by \0. NL should do it.

>Then again, you can theoretically have newlines in a
>filename... (hooray sentinel values!)

>>>Another option is to temporarily redefine IFS.
>>
>>"/" can't occur in filenames.
>
>Er? You referring to "../test.tar"? That means
>"test.tar in the parent directory"

You can't have files named "foo\0bar" or "foo/bar".
Having a _path_ foo/bar is just fine.

>If you're referring to absolute vs relative filenames
>inside a tar file, that's a different issue.

Oh, I don't know about tar's rules. Presumably they're similar to Linux's.

-- 
-eben    QebWenE01R@vTerYizUonI.nOetP    royalty.mine.nu:81
TAURUS:  You will never find true happiness - what you gonna
do, cry about it?  The stars predict tomorrow you'll wake up,
do a bunch of stuff and then go back to sleep.  -- Weird Al

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:15:20 EDT