|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Extracting .tar files.
Hey guys complete n00b here so I'll try my best at explaining. I'm creating a backup and restore utility and decided to use tar. I create a backup folder in each user's account and when backing up (say word processing files), I use the following: Code:
tar cvf /home/user/backup/wpbackup.tar /home/user/wp/* When I go to extract, though, I'm using the following command: Code:
tar xvf /home/user/backup/wpbackup.tar Problem is that this creates a /home/user/wp/ path IN the backup directory, as well as extracting the files in there. What I would like to know is how to fix this so that the extracted files from wpbackup.tar are put back into the /home/user/wp/ directory. That's my primary aim^, however if I can't get that working is there any way to extract the contents of the tar file into the directory it was created in (/backup), so I can just copy them across to the user's appropriate directory? Cheers for any help, Ewan |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
Sounds like you are sitting in the backup directory when you extract. Tar will extract to wherever you are.
cd / tar xvf /....... |
|
#3
|
||||
|
||||
|
I would say more likely is that tar is extracting using the full path.
It is in most cases better to tar things up using relative paths. Then you can untar it wherever you like. ---------- Post updated at 06:40 PM ---------- Previous update was at 06:32 PM ---------- The BSD tar on my Mac contradicts what I just said, but on Solaris and AIX (and I think probably HP-UX), it's accurate enough. The Solaris man page says "Absolute path names contained in the archive are unpacked using the absolute path names, that is, the leading forward slash (/) is not stripped off" |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extracting data from files.. | anchal_khare | Shell Programming and Scripting | 1 | 04-03-2008 06:56 AM |
| extracting files using date in ksh | pavan_test | UNIX for Dummies Questions & Answers | 1 | 04-04-2006 03:29 PM |
| Is extracting specific files from a zip file possible? | HLee1981 | UNIX for Dummies Questions & Answers | 1 | 10-14-2005 11:06 PM |
| Extracting values from files | Master Error | Shell Programming and Scripting | 4 | 08-15-2004 09:23 AM |
| extracting .rar files | sskb | UNIX for Dummies Questions & Answers | 5 | 05-15-2002 09:20 PM |