I have a tar.gz-file with the following structure:
folder1/img.gif folder2/img2.gif folder3/img3.gif
I want to extract the image files without
Check the tar version e.g.
$ tar --version
If version is >= than tar-1.14.90 use --strip-components
--strip-components
tar xvzf web.dirs.tar.gz -C /srv/www --strip-components 2
else use --strip-path
--strip-path
tar xvzf web.dirs.tar.gz -C /srv/www --strip-path 2