07-21-2008
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.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. UNIX for Advanced & Expert Users
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
3. UNIX for Dummies Questions & Answers
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
4. UNIX Desktop Questions & Answers
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
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. Solaris
Hi,
How do I extract data from TAR excluding absolute paths for Tar? (Solaris)
Thanks (3 Replies)
Discussion started by: zam
3 Replies
10. UNIX for Dummies Questions & Answers
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
LEARN ABOUT CENTOS
git-tar-tree
GIT-TAR-TREE(1) Git Manual GIT-TAR-TREE(1)
NAME
git-tar-tree - Create a tar archive of the files in the named tree object
SYNOPSIS
git tar-tree [--remote=<repo>] <tree-ish> [ <base> ]
DESCRIPTION
THIS COMMAND IS DEPRECATED. Use git archive with --format=tar option instead (and move the <base> argument to --prefix=base/).
Creates a tar archive containing the tree structure for the named tree. When <base> is specified it is added as a leading path to the files
in the generated tar archive.
git tar-tree behaves differently when given a tree ID versus when given a commit ID or tag ID. In the first case the current time is used
as modification time of each file in the archive. In the latter case the commit time as recorded in the referenced commit object is used
instead. Additionally the commit ID is stored in a global extended pax header. It can be extracted using git get-tar-commit-id.
OPTIONS
<tree-ish>
The tree or commit to produce tar archive for. If it is the object name of a commit object.
<base>
Leading path to the files in the resulting tar archive.
--remote=<repo>
Instead of making a tar archive from local repository, retrieve a tar archive from a remote repository.
CONFIGURATION
tar.umask
This variable can be used to restrict the permission bits of tar archive entries. The default is 0002, which turns off the world write
bit. The special value "user" indicates that the archiving user's umask will be used instead. See umask(2) for details.
EXAMPLES
git tar-tree HEAD junk | (cd /var/tmp/ && tar xf -)
Create a tar archive that contains the contents of the latest commit on the current branch, and extracts it in /var/tmp/junk directory.
git tar-tree v1.4.0 git-1.4.0 | gzip >git-1.4.0.tar.gz
Create a tarball for v1.4.0 release.
git tar-tree v1.4.0^{tree} git-1.4.0 | gzip >git-1.4.0.tar.gz
Create a tarball for v1.4.0 release, but without a global extended pax header.
git tar-tree --remote=example.com:git.git v1.4.0 >git-1.4.0.tar
Get a tarball v1.4.0 from example.com.
git tar-tree HEAD:Documentation/ git-docs > git-1.4.0-docs.tar
Put everything in the current head's Documentation/ directory into git-1.4.0-docs.tar, with the prefix git-docs/.
GIT
Part of the git(1) suite
Git 1.8.3.1 06/10/2014 GIT-TAR-TREE(1)