I m trying to extract files contained within a directory in a tar.gz file. The extract I m using is tar zxvf foo.tar.gz. It extracts the files from the archive but removes them from the directory they are in. I want to extracted them to the directory that contains them, and want to be able to do this for multiple archives. Any help would be great!
I'm not soure about your descption. At first list files and be soure where they are:
In your question a hope, files are flat in archive without any directory. If you want extract to any dir, make this and simple extract:
I hope this helps. -C option cause, tar themselves move current directory to $DIR and under this do job.