ServerOverflow
asked on
tar command and relative paths
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/bla h.tif
home/dummy/imageFolder/bla h2.tif
home/dummy/imageFolder/sub Dir
home/dummy/imageFolder/sub Dir/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 /)
If I have a tar that contains a bunch of files like:
home/dummy/imageFolder/bla
home/dummy/imageFolder/bla
home/dummy/imageFolder/sub
home/dummy/imageFolder/sub
...
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 /)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I knew about that -C, but I had the syntax wrong, thanks for the example
`man tar` for details