[ILUG] Extract tar file
Conor Mac Aoidh
conormacaoidh at gmail.com
Fri Jan 30 18:27:32 GMT 2009
Thanks for clearing that up! :-) the method you suggested does the job
rightly!
Thanks
---
Conor
http://macaoidh.name
On 30 Jan 2009, at 18:23, David De La Harpe Golden <david at harpegolden.net
> wrote:
> Conor Mac Aoidh wrote:
>> Hi,
>> I have a question about extracting a tar file. This is what I have:
>> tar xvf filename.tar.bz2 -C /target
>> at the moment this creates a new folder and puts the contents in it,
>> /target/filename/contents
>>
>
> Actually, technically, to clear up a confusion you probably have -
> the entry names *in the tar file itself* likely have a directory
> prefix "filename/" at the start, by convention. You could rename
> filename.tar.bz2 to supermonkey.tar.bz2 and you will find it would
> still expand to filename/contents
>
> You can see this with
> tar jtvf filename.tar.bz2
>
> (contrast windoze where the standard - and thoroughly braindead -
> convention is to make entries in .zip files without the directory
> prefix so they infuriatingly expand into a big uncontained mess o'
> files by default)
>
> It is quite possible to create tar archives without a such leading
> prefix in the
> entries, but unix and linux folk will generally regard it as
> phenomenally annoying
> except in limited circumstances where tar is being used as a
> filesystem
> backup tool.
>
>> how can i tell it to put the contents of the tar directly into that
>> folder so they would be here: /target/contents
>>
>
> In effect, you want to drop one path component from the tarfile's
> entries. This is, despite my rant, common enough, so gnu tar and
> most unix tars have a "strip" option, in the gnu case:
>
> tar jxvf filename.tar.bz2 -C /target --strip 1
>
>
>
>
>
>
>
>
>
>
More information about the ILUG
mailing list