Sponsored Content
Top Forums Shell Programming and Scripting Question regarding tar command. Post 302991445 by bakunin on Friday 10th of February 2017 03:35:10 PM
Old 02-10-2017
Quote:
Originally Posted by mohtashims
I wish my tar -xf hello.tar command should return successful even if the tar has already been extracted at the same location
And i wish i had better thought-through questions to answer. Seems like we both don't get what we want.

How should tar know it "has already been extracted", hmm?

- how would tar know at all, because if the pathes in an archive are relative the archive could have been unpacked into a very different place in the filesystem;

- even if there are some files matching the name of files in the archive - how would tar find out if they are complete or if some are missing?

- even if the unpacked file collection is complete, how would tar find out if they are of the same content as the ones in the archive (that is,without actually unpacking them all and running a - hypothetical - "binary diff" against every one of them?

- and even if such a hypothetical analysis would turn out to be successful, how would tar make sure the surely existing diferences in inode content (mtime, ctime, owner, whatever) doesn't matter? Which (amount of) difference exactly should tartolerate and still consider a specific pair of files (in- and outside the archive) to be equal?

What you want: doesn't exist, is theoretically impossible (and actually against the law of thermodynamics, so its safe to say it will never exist). Does that answer your question?

I hope this helps.

bakunin
These 2 Users Gave Thanks to bakunin For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tar question

Folks, I've created a tar file on tape using: tar xvf /dev/rmt0 The directory I was in was: \IMPULS\F50D01\temperik under temperik the tar command created subdirectories. I need too BACKUP these subdirectories again and restore them on another machine, But when i'm going to... (10 Replies)
Discussion started by: Erik Rooijmans
10 Replies

2. UNIX for Dummies Questions & Answers

Question regarding tar restore

I created a relative backup of my home directory using tar into a file named backup.tar. No problem there. I checked it out using the table of contents command to list the contents of the backup.tar file, and there is no problem there either. But, when I tried restoring backup.tar into a... (2 Replies)
Discussion started by: Relykk
2 Replies

3. UNIX for Dummies Questions & Answers

Question on Tar command

Hi, I have a simple question. How do I get a tar of all the files under specific directory which are created on some specific date? Suppose I am in /home/user123/logs. I need the tar of all the logs which are created on May 07. There are some 30 files of that date. Please help. Thanks. (2 Replies)
Discussion started by: everurs
2 Replies

4. Shell Programming and Scripting

un-tar question

Hi all, My examples.tar has about 20 directories. I don't want to un-tar the entire examples.tar. Is there a way to un-tar just a directory named "java" from examples.tar? Please let me know JAK (2 Replies)
Discussion started by: jakSun8
2 Replies

5. UNIX for Dummies Questions & Answers

tar file question

Hi I did this command to tar the files but I got an error. tar -cvpf filename.tar pathname/ It did tar the file filename.tar but then it gave me this error "Reach end of file before expected". The new tar file is about 2GB. So does that mean my tar file limit is 2GB? Is there a max limit... (4 Replies)
Discussion started by: chaoses
4 Replies

6. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

7. Shell Programming and Scripting

tar command dont tar to original directory

HI, if I have a tarfile called pmapdata.tar that contains tar -tvf pmapdata.tar -rw-r--r-- 0/0 21 Oct 15 11:00 2009 /var/tmp/pmapdata/pmap4628.txt -rw-r--r-- 0/0 21 Oct 14 20:00 2009 /var/tmp/pmapdata/pmap23752.txt -rw-r--r-- 0/0 1625 Oct 13 20:00 2009... (1 Reply)
Discussion started by: borderblaster
1 Replies

8. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

9. Shell Programming and Scripting

tar -C syntax question

I am writing a perl script to tar multiple files (in unix) from a given directory to a given output directory. I do NOT want the file path included in the tar, so I've flagged the -C option. Example: tar -cvf tar/1.tar -C htmp/source/ 1-1-1.xml However, I need to do this for a number of target... (3 Replies)
Discussion started by: michanjohns
3 Replies

10. Shell Programming and Scripting

Tar question

Hi all, newbie here. Could anyone help me how to combine a tar -c and tar -x command such that the source file/folder is archived into a target file in the destination folder (may or may not be in the same server), and extracted directly (through pipe?) in that same destination folder? Thanks... (2 Replies)
Discussion started by: frys_hp
2 Replies
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)
All times are GMT -4. The time now is 06:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy