help-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-tar] Trouble with tar -xzf when using --files-from=-


From: Tony Olekshy
Subject: Re: [Help-tar] Trouble with tar -xzf when using --files-from=-
Date: Thu, 22 Oct 2015 19:14:25 -0600
User-agent: KMail/4.10.5 (Linux/3.11.10-100.fc18.x86_64; KDE/4.10.5; x86_64; ; )

Reuti wrote, on 2015-10-21 at 05:10 MDT:
>   
> Ah, although I missed the --no-recursion at the first glance: its 
> position is important. It must appear before the --files-from=- in
> your case.

Tony Olekshy wrote, on 2015-10-21 at 06:30 MDT:
>   
> Perfect, that did it. The attached script with the --no-recursion
> placed before the --files-from=- does exactly what I'm looking
> for, and I've tested it with a filter between the tar -t and the 
> tar -x (a simple head -2 works for this testing), and it all 
> works well.
>   
> cd $TEST; $TAR --list --gzip --format=gnu --force-local         \   
>         --file=$TEST/archive.tgz | head -2 | ( cd $TEST/into;   \   
>     $TAR -v --extract --gzip --format=gnu --force-local --seek  \
>         --sparse --overwrite --no-recursion --no-unquote        \   
>         --files-from=- --file=$TEST/archive.tgz                 )   
>   
> Thank you very much for you assistance with this matter, Reuti.
> Now I understand the difference between tar's globally scoped
> options and those that only apply to succeeding arguments.

Reuti wrote, on 2015-10-22 at 08:37 MDT:
>   
> A short question: did you test your script also with 1.28? While
> it is working in 1.26 now, I get the impression that in 1.28:
>   
> 1) --files-from must be an exact match, hence --no-recursion
>    has no meaning for it now 
>   
> 2) Due to 1), plain directories can't be extracted with
>    --files-from any longer, only on the command line [...]
>   
> Can you confirm this?

Reuti wrote, on 2015-10-22 at 09:00 MDT:
>   
> Aha, while you can extract "./" or "./foo/" on the command line,
> only a plain "." or "./foo" is allowed in the --files-from=.
> Nevertheless will the --list append the / for a directory in the 
> output again.

I modified my program to be sure to strip trailing "/"s from the 
tar --list output before passing it to tar --extract --files-from,
and I've tested it with tar 1.26 and with tar 1.28, and it works.

Thanks again for you help with this Reuti. I've been programming
various flavours of Unix for 40 years (sic), and I used tar back
in those days to do blocked backups to 9-track reel-to-reel tape,
but it is only now that I've come to appreciate the intricacies
of tar's operation.

Yours, &c, Tony Olekshy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]