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
This is almost possible with tar alone, using the --transform flag, except that there's no way to delete the left over directories as far as I can tell.
This will flatten the entire archive:
tar xzf images.tgz --transform='s/.*\///'
The output will be
folder1/
folder2/
folder3/
img.gif
img2.gif
img3.gif
You will then need to delete the directories with another command, unfortunately.