hmmmm.... [EMAIL PROTECTED]:~> rpm -q tar tar-1.15.1-42.2 and man tar shows neither option! never mind, --strip-components is available and does what I'm looking for.
And thanks Steve too for the other option. Cheers, Roger Peter Glassenbury (CSSE) wrote: > Checking out "man tar" I saw these two options...(I have only > used the -C so test it out a bit.. :-) ) > > > --strip-components NUMBER, --strip-path NUMBER > strip NUMBER of leading components from file names before > extraction > (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components > > Try something like tar xf yourtarfile --strip-path 4 > and see what happens > > -C, --directory DIR change to directory DIR > > This I have used in creating... > example% tar c -C /usr include -C /etc . > > The table of contents from the resulting tarfile would pro- > duce output like the following: > > include/ > include/a.out.h > and all the other files in /usr/include ... > ./hosts and all the other files in /etc > > Pete > > Roger Searle wrote: >> Then extract the files from the tar file to my home directory I would >> get the files in >> /home/roger/toplevel/subfolder/next/another/lastfolder/. Is there a >> command to take out 4 levels of folders from this structure >> so the files go into /home/roger/lastfolder? Either during or after >> extracting from the tarfile? >> >> The situation I have relates to a tar file created by someone else, so I >> am wanting to deal with a tarfile already created. I would however also >> be interested in an option to ignore the top x levels of folders that is >> saved when creating a tar file too. > > > >
