Re: stripping leading directories from tar file
Eric Koldeweij <[email protected]>
| Newsgroups | gmane.linux.redhat.release.enigma |
|---|---|
| Message-ID | <[email protected]> |
I don't think that can be done with tar, at least not as far as I know. However, there's an easy solution if all files inthe archive start with "mnt/hdd" ln -s / /mnt/hdd You have to rmdir /mnt/hdd first if it already exists of course. This makes a symbolic link from /mnt/hdd to / cd to / and untar the archive. Works like a charm. Eric. Jon Miller wrote: >I have a tarred file that has several directories before the filename: >ex: mnt/hdd/etc/filename.tar.gz >What I need to do is untar the file to: >/etc/filename >I'm assuming if I issue the following command it will yield the wrong results >tar -xzvf filename.tar.gz /etc >/etc/mnt/hdd/etc/filename >Is there a way to strip off the /mnt/hdd? > >Thanks > > >