[sclug] strip paths from file when tarring?

John Stumbles john at stumbles.org.uk
Sat Mar 5 21:47:18 UTC 2005


[rats! just replied to sender instead of to list again: here it is for 
everyone to shoot down :-)]

-------- Original Message --------
Subject: Re: [sclug] strip paths from file when tarring?
Date: Sat, 05 Mar 2005 21:45:27 +0000
From: John Stumbles <john at stumbles.org.uk>
To: darren at davisononline.org
References: <1110054963.14266.4.camel at garbo.davisononline.org>

Darren Davison wrote:
> I'm trying to generate a tbz2 file from a couple of directories and a
> log file..
> 
> tar cjf mytar.tbz2 foo/ bar/ long/path/to/logfile.log
> 
> however, I want logfile.log to appear in the root of the archive - can I
> optionally strip "long/path/to/" from this one file while generating the
> tarball?

like this?

tar cjf mytar.tbz2 foo/ bar/; cd long/path/to/; tar cjf mytar.tbz2 \
logfile.log

not sure about the flags (cjf) - obviously you want to add the logfile
to the now-existing archive file (and I can't be bottomed to rtfm,
especially as I recall it's a $%&**! info file instead of a proper man
page :-()

-- 
John Stumbles                                      mobile 0780 866 8204
plumbing:heating:electrical:property maintenance     home 0118 954 2406


More information about the Sclug mailing list