Quote:> I have a command which outputs to STDOUT a bunch of absolute paths to
> some files of interest:
> /tmp/x
> /tmp/y/z/g/x.txt
> /tmp/er/wsdf/sddd.doc
> I would like to tar all of these files up, but have them untar in
> relative fashion. ie,
> tmp/x
> tmp/y/z/g/x.txt
> tmp/er/wsdf/sddd.doc
Hmmm. If they're really all under the same tree all nice like
that, you should be able to something like this:
cd /
tar -cf file.tar `(command) |cut -c2- |xargs`
The 'cut -c2-' gets rid of the leading slash, the 'xargs' with no
arguments sticks 'em all onto one line.
If they're *not* all under the same tree, or you need the tree to
be different - say, for example, you've got:
/u01/staging1/docs/file1.txt
/u02/staging2/docs/file2.txt
and you want to have them both untar in:
/u03/staging3/docs/
Then you get into doing something like:
cd /u01/staging1/
tar -cf /u03/staging3/file.tar -C /u01/staging1 `(command) |xargs`
cd /u02/staging2/
tar -rf /u03/staging3/file.tar -C /u02/staging2 `(command) |xargs`
where 'command' in this case outputs filenames with a relative
path, based on the path passed with the -C flag.
Hope this is vaguely helpful.
-Dan
--
This address expires. Take out the hostname if your reply bounces.
Read http://dan.scream.org/pay4spam.html before you send ads to me.
This address may not be distributed unless this notice is included.
Visit http://dbirchall.epinions.com/user-dbirchall for my opinions.