I'm currently using this command
tar -zxvf foo.tgz -C /root/dir1/ dir2/dir3/dir4/dir5/file
to extract my specific file from a tar archive to a given directory, dir1. As is, I end up with root/dir1/dir2/dir3/dir4/dir5/file
but what I am after is root/dir1/file
. This is important because I have 1000 of these files and I don't want to have to open all the individual directories to get to them. Does anyone know how to extract just the file?
Many thanks.