Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-21-2007, 07:30 PM   #1
Registered: Jan 2007
Location: PA, USA
Distribution: Ubuntu Jaunty (9.04)
Posts: 31

Rep: Reputation: 16
remove directory info from tar file


I have some tar files that are 3gb or larger. A listing of their contents shows that they have files that do not need to be backedup. I created a folder named "untarhere" to extract the file contents into. My question/problem is: How do I create a tar archive without it saving the "untarhere" folder name.

Directory layout:
# cd /untarhere
# ls
2007_Jul_12  2007_Jul_13 2007_Jul_14
If I run
# tar vcf ./2007_Jul_12.tar.gz /untarhere/2007_Jul_12
and then
# tar tf ./2007_Jul_12.tar.gz
I get
The output I want to see is this:
I do not want "/untarhere" to be saved in the tar file. How do I tell tar to do this?
Old 08-21-2007, 07:52 PM   #2
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
Try using -C to change to untarhere first and then just specify the sub-directory of untarhere to back up:
tar -vcf ./2007_Jul_12.tar.gz -C /untarhere 2007_Jul_12
Does that do what you need?
Old 08-22-2007, 03:24 PM   #3
Registered: Jan 2007
Location: PA, USA
Distribution: Ubuntu Jaunty (9.04)
Posts: 31

Original Poster
Rep: Reputation: 16

Does what I need it to.


backup, tar

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract specific directory from a TAR file? Micro420 Linux - General 4 04-18-2007 12:04 AM
Unable to create a tar file from spanning a directory tree? R00ts Linux - General 2 11-01-2006 10:15 AM
info problem "info: dir: No such file or directory" EAD Linux - Software 0 03-22-2006 02:16 PM
tar -zvf file.gz in which directory to open? solutionseeker Linux - Newbie 3 01-30-2005 01:31 AM
Anyway to lock apache log file before I tar the directory? m3kgt Linux - General 2 11-05-2003 11:51 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration