I created a file named me.txt
with text
This is dummy text
Then I made a TAR out of it and named me.txt.tar
.
Now after a minute I again created a file with exactly same name and the text (basically I just did touch me.txt
), then made TAR out of it called me2.txt.tar
.
Technically both the tars have same file with same file contents but time of creation of file me.txt
is different. But the diff tool is saying:
Binary files me.txt.tar and me2.txt.tar differ
This is because of reason of timestamp difference of file creation. But I just want to compare the contents of file and need to ignore the timestamp & hence I expect no output from the diff.
Please help me to ignore the timestamp of the files inside a TAR or JAR etc. as my concern is towards the contents of files.
- The commands I used are :
$ echo "This is dummy text" > me.txt $ tar -cvf me.txt.tar me.txt (After 1 minute or so..) $ touch me.txt $ tar -cvf me2.txt.tar me.txt $ diff me.txt.tar me2.txt.tar
- output:
Binary files me.txt.tar and me2.txt.tar differ
Even diffoscope
gives similar output.
diff
to compare aren’t the same. If you want to compareme.txt
, you need to compare that;me.tar
andme2.tar
don’t have the same contents.