bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] --files-from and --same-permissions


From: Neal P. Murphy
Subject: Re: [Bug-tar] --files-from and --same-permissions
Date: Mon, 21 Nov 2016 22:53:07 -0500

On Sun, 20 Nov 2016 09:27:27 +0200
Sergey Poznyakoff <address@hidden> wrote:

> Neal P. Murphy <address@hidden> ha escrit:
> 
> > Wait. Do I have to explicitly specify every dir in each file's path
> > when selecting a subset of files in a tarball?
> 
> Judging by the question, the following link might be of interest to you:
> 
>   http://lists.gnu.org/archive/html/bug-tar/2016-09/msg00019.html

Apologies. 30 years of using UNIX/Linux and only *now* have I noticed that this 
is how tar/cpio/rsync work.

But I thought of a fairly elegant solution: get all of the dir names. Assume 
that the list of files (with './') to extract is in pkg.list. The list is a 
subset of all of the files in pkg. Then:
----
while read path; do
  path=`dirname $path`
  while [ "$path" != "." ]; do
    echo $path
    path=`dirname $path`
  done
done < pkg.list | sort | uniq > pkg.dirs
mkdir distrib
tar xvf path/to/pkg.tar.gz -C distrib -T pkg.list -T pkg.dirs
----

Caveat: the dirs also must be in the archive.



reply via email to

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