LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 08: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 08:18 PM.
 
Old 02-21-2007, 01:59 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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, 04: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 08:45 AM.
 
  


Reply



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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
tar | ssh (tar > .tar) syntax issues EarlMosier Linux - Software 6 12-21-2006 12:28 AM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:50 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration