LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices



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

Rep: Reputation: 16
remove directory info from tar file


Hi.

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:
Code:
# cd /untarhere
# ls
2007_Jul_12  2007_Jul_13 2007_Jul_14
If I run
Code:
# tar vcf ./2007_Jul_12.tar.gz /untarhere/2007_Jul_12
and then
Code:
# tar tf ./2007_Jul_12.tar.gz
I get
Code:
/untarhere/2007_Jul_12/
/untarhere/2007_Jul_12/file1
/untarhere/2007_Jul_12/file2
/untarhere/2007_Jul_12/directory1
/untarhere/2007_Jul_12/directory2
...
The output I want to see is this:
Code:
/2007_Jul_12/
/2007_Jul_12/file1
/2007_Jul_12/file2
/2007_Jul_12/directory1
/2007_Jul_12/directory2
...
I do not want "/untarhere" to be saved in the tar file. How do I tell tar to do this?
 
Old 08-21-2007, 08:52 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

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

Original Poster
Rep: Reputation: 16
Thanks

Does what I need it to.
 
  


Reply

Tags
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 01:04 AM
Unable to create a tar file from spanning a directory tree? R00ts Linux - General 2 11-01-2006 11:15 AM
info problem "info: dir: No such file or directory" EAD Linux - Software 0 03-22-2006 03:16 PM
tar -zvf file.gz in which directory to open? solutionseeker Linux - Newbie 3 01-30-2005 02:31 AM
Anyway to lock apache log file before I tar the directory? m3kgt Linux - General 2 11-05-2003 12:51 PM


All times are GMT -5. The time now is 01:18 AM.

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