Results 1 to 4 of 4
Hello everyone,
I have a tar.gz file containing many sub-folders, I am trying to untar the file so all the files in sub-folders will be extracted into the one folder, ...
- 06-25-2009 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 2
how to run tar wtihout re-create folders
Hello everyone,
I have a tar.gz file containing many sub-folders, I am trying to untar the file so all the files in sub-folders will be extracted into the one folder, I know how to use ubuntu tar GUI program to do it by uncheck option called re-create folders, but how can I do it in shell by using tar command?
tar -xvf name.tar.gz will re-create folders by default, I don't see any option to override this, anyone can help?
Thanks,
TomLast edited by canadatom; 06-26-2009 at 06:24 PM. Reason: problem solved
- 06-26-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
I don't know of a way to do that with 'tar'. I just read thru the manpage and could not find anything there either. What I would do is to extract the tarball and then use the 'find' command to move all the files to the current directory. Ie,
You might see some warnings from 'mv' about files being the same, and if there are duplicate file names in the archive, then what you get in your local directory will be the last one found. If you leave off the -f argument from mv, then you will be asked if you want to overwrite duplicate-named files. Finally, remove the directories created by extracting the archive.Code:tar -xzvf tarball find . -type -exec mv -f {} . \;Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-26-2009 #3Just Joined!
- Join Date
- Jun 2009
- Posts
- 2
this is really helpful, I think shell script method works.
I also tried using 7-zip to unzip the tar.gz file by typing:
it will automatically extract all the files into current directory.Code:7z e filename.tar.gz
- 06-26-2009 #4


Reply With Quote
