untar in another dir
hi,
small question, but handy if i know how it works (i cant find it anywhere) i am trying to untar a tar file into another dirrectory like this: > tar -xzvf test.tar > dir/ i tried everything but nothing works and get only the error -bash: dir: Is a directory if this is not possible can i than copy the content of a whole dir into another dir? please advise me with the command... thanks Tim |
tar xjf test.tar.bz2 -C /path/to/dir
|
Look at the Man page for tar, it gives you the correct syntax
Code:
man tar tar -xzvf /home/yourname/filename /anotherdir/etc/filename You'll need to have permission to write to that dir of course. |
well...
this looks more like zipping the file instead of UNzipping it... i tried the command but its not working i think i should be starting something like: > tar -zxvf test.tar ................... but the last part should be it whats missing Ps. if this is not possible does anyone know a way to copy the whole contents of a dir. into another dir....? Tim |
This worked for me, but I had to use the full pathname. Using tar -zxf test.tar.gz -C projects didn't work. In my home directory:
$ vi test.txt $ tar -zcf test.tar.gz test.txt $ tar -zxf test.tar.gz -C /home/mhearne/projects $ ls projects test.txt Michael |
Quote:
but the thing is that i have more than one file so i zipped the whole dir. with 10 files in them. Now these files i wanna unpack in different dirs. but that is not possible... cos unpacking means putting the dir theire. but in fact i only want the content of that dir unpacked in another dir.. Still got it? :-) |
Hi Timmy01,
Doing the same thing with a whole dir also works for me: $ tar -zcf projects.tar.gz projects $ tar -zxf projects.tar.gz -C /home/mhearne/tmp $ls tmp projects/ But, if you want to move it to an area that you don't own, then you may have to be root or have sudo privileges. Michael |
All times are GMT -5. The time now is 02:14 AM. |