?
Solved

tar command and relative paths

Posted on 2003-03-06
3
Medium Priority
?
985 Views
Last Modified: 2010-05-18
Ok I have a tar-ing problem was wondering if someone could help...

If I have a tar that contains a bunch of files like:
home/dummy/imageFolder/blah.tif
home/dummy/imageFolder/blah2.tif
home/dummy/imageFolder/subDir
home/dummy/imageFolder/subDir/blah5.tiff
...

is there a way to extract all the files/dirs in the imageFolder without having tar make the complete dir home/dummy/imageFolder

(when i run "tar -xvf mytar.tar" it makes the complete dir path from where ever I ran it...)


OR if this isn't possible, is there a way to tar a folder using a complete path /home/blah/blah/myFolder but so that the path in the tar is just myFolder/ , that way the extraction wont make that complete path when I call it...



Thanks for your time.

PS. (please dont tell me I should cd to the dir, I know this, but Im doing some remote programming, and the cd command is not a valid option, everything is being done using absolute paths from /)
0
Comment
Question by:ServerOverflow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 21

Expert Comment

by:tfewster
ID: 8082861
Try the -C option to tar (if your version supports it)
`man tar` for details
0
 
LVL 21

Accepted Solution

by:
tfewster earned 195 total points
ID: 8082926
e.g. tar cvf test.tar -C home/dummy  imageFolder
0
 

Author Comment

by:ServerOverflow
ID: 8083973
Thanks, I knew about that -C, but I had the syntax wrong, thanks for the example
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question