Extracting certain /paths/* using tar


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory Extracting certain /paths/* using tar
# 1  
Old 07-21-2008
Error Extracting certain /paths/* using tar

forgive my ignorance.
I did a search of this sub-forum for "tar -xp" and variations on the same w\out success, so here goes...

Scenario:
filename.tar file.

Desired Task:
I want to be able to extract only files from the user's public_html folder (and all those under it as an option) from the archive.

Usual target path:
/home/$user/public_html/*
(the archive is on a nas, so extracting to the current directory where the archive lives will have to do, for now).

What I've tried:
tar --extract --file=-filename.tar $user (I think this worked, but I was i a hurry and at the end of a long day)

What I've read to try:
tar -xp <something> (haven't had the chance to try anything along these lines)

Thank you for your time and assistance.
# 2  
Old 07-21-2008
User tar -tf <tarball> to verify the structure of the tarball first but you should be able to just name the directory to extract and it'll do that and all subdirs of it, thus:
Code:
tar xf tarball.tar /home/$user/public_html

# 3  
Old 07-22-2008
Great!
I'll have a go of it today, I'm sure.
# 4  
Old 08-01-2008
it works.

Thanks Smiling Dragon!
# 5  
Old 08-03-2008
Happy to help Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Tar stucks while extracting

I am trying to extract tar file of size 167MB but most of the times tar command stuck while extraction. Command: new 24389 24369 0 Nov21 ? 00:00:00 tar -xf NCSanJose1_req_rep.tar While running process with gdb following back trace was obtain: ... (24 Replies)
Discussion started by: freebee
24 Replies

2. Solaris

exclude absolute paths when extracting Tar file?

Hi, How do I extract data from TAR excluding absolute paths for Tar? (Solaris) Thanks (3 Replies)
Discussion started by: zam
3 Replies

3. Shell Programming and Scripting

tar and relative paths

HOw can I create a tar file with relative paths find . -depth -print | xargs tar -cvf /tmp/file.tar ? Thanks to all who answer (1 Reply)
Discussion started by: BeefStu
1 Replies

4. Shell Programming and Scripting

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: tar cvf /home/user/backup/wpbackup.tar... (2 Replies)
Discussion started by: EwanD
2 Replies

5. Shell Programming and Scripting

tar after replacing paths from a file

There is a file paths.txt with paths containing data for example E:/<BUILD_NAME>/data/common E:/<BUILD_NAME>/log/common E:/<BUILD_NAME>/temp/common E:/<BUILD_NAME>/code/common While reading this file I want to replace the <BUILD_NAME> from a variable $BUILD in the following command: tar... (1 Reply)
Discussion started by: muaz
1 Replies

6. Shell Programming and Scripting

tar the paths from a input file

Hi, I have a file paths.txt with all the file paths. I want to tar everything in those paths to a file. for example paths.txt contains /data/extention /logs/extension /code/extenstion Now I want to tar using command tar cvf extention.tar path1 path2 where path1 -> /data/extention... (2 Replies)
Discussion started by: muaz
2 Replies

7. UNIX Desktop Questions & Answers

Extracting from a tar file

Can I extract files from an archive file (tar), where the filename includes the full directory path, to a different directory? For example the archive files may have a filename of /SrcFiles/XXX/filename.dat and I want to extract it to /SrcFiles/YYY/filename.dat. Since the archive file... (1 Reply)
Discussion started by: nmalencia
1 Replies

8. UNIX for Dummies Questions & Answers

extracting from a tar file

Dear experts I have received a tar file containing several files with full path. Now I need to restore it in another system but when I want to extract files by using tar -xvf tarfile it wants to create all files with full paths again in new system in which I don't have enough previleges. How... (4 Replies)
Discussion started by: Reza Nazarian
4 Replies

9. UNIX for Advanced & Expert Users

extracting from tar.bz2

hi could any body tell me how to extract .tar.bz2 files i tried using tar but in vain. i found bzip2 in googling but i could not find it on machine unix tru64 please suggest. (1 Reply)
Discussion started by: Raom
1 Replies

10. UNIX for Dummies Questions & Answers

error while extracting using TAR

Hi folks, When I am extracting an archive using the: tar -xvf /dev/rmt0 command i get the following error: x ./GRBD8901/GRBR006T, 1763253368 bytes, 3443855 media blocks. tar: 0511-197 ./GRBD8901/GRBR006T: Cannot write data extracted with the tar command: ... (7 Replies)
Discussion started by: Erik Rooijmans
7 Replies
Login or Register to Ask a Question