LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-20-2007, 09:16 PM   #1
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
Question tar --compare


hello,
how to compare contents of archive to directory?

tried this:
tar --compare --file=file.tar dir
tar --compare --file=file.tar dir/

tar: dir: Not found in archive

tar --compare --file=file.tar dir/*

tar: dir/file: Not found in archive
tar: dir/file: Not found in archive
tar: dir/dir: Not found in archive

Last edited by ygloo; 02-20-2007 at 09:18 PM.
 
Old 02-21-2007, 02:59 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Usually the --compare (-d) option is used immediately after having created the archive. You just simply do
Code:
tar -dvf file.tar
and the content of the archive will be compared with the directory specified as relative path to the files inside the archive. In other words, you have not to specify a directory - against which to compare - in the command line. Tar itself take care of looking for the relative path of each archived file.
 
Old 02-23-2007, 05:21 PM   #3
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Original Poster
Rep: Reputation: 30
hello,
Code:
tar -cpf file.tar dir
tar -dvf file.tar
works when file.tar is in directory it was created

to compare when archive is in different location i did:
Code:
tar -dvf file.tar -C /path/to/dir
tux happy!
Code:
   .--.     
  |o_o |
  ||_/ |     
 //   \ \
(|     | )  
/'\_   _/`\ 
\___)=(___/

Last edited by ygloo; 02-24-2007 at 09:45 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 11:55 AM
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 10 02-23-2008 06:40 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM
tar | ssh (tar > .tar) syntax issues EarlMosier Linux - Software 6 12-21-2006 01:28 AM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 07:30 AM


All times are GMT -5. The time now is 05:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration