0

I have crontab event archives to .tar.gz some folder every N hours. Finally I have collection of .tar.gz files. Now I want remove duplicating archives (created while target files stays unchanged) How can I do that.

I tried to perform comparison by checking hashsum, but tar.gz archives always has different sum:

altera@nuclight:~$ rm -rf *
altera@nuclight:~$ echo "Hello world" > file
altera@nuclight:~$ tar czf a1.tgz file
altera@nuclight:~$ tar czf a2.tgz file
altera@nuclight:~$ tar czf a3.tgz file
altera@nuclight:~$ tar czf a4.tgz file
altera@nuclight:~$ tar czf a5.tgz file
altera@nuclight:~$ ls
a1.tgz  a2.tgz  a3.tgz  a4.tgz  a5.tgz  file
altera@nuclight:~$ md5sum *.tgz
e8587f4c381856af9278a6ef2a452b00  a1.tgz
2f44617fb164e66a74c5c4992637e7d4  a2.tgz
1a094b315e2d0891a0c5dafebae9718f  a3.tgz
6c3642d2441397c24e4de5377b9e0a7e  a4.tgz
7c0e9128ef47a9dbcda0dd008e34cd8d  a5.tgz
altera@nuclight:~$

1 Answer 1

0

If your source files are completely untouched, running a hash/checksum on your archives should produce the same results for unchanged files. Then simply delete files with duplicate hashes.

3
  • Already tried, post edited
    – atomAltera
    Mar 3, 2013 at 7:37
  • If the MD5 hash changes, then the contents of the files are not identical, so maybe what you need to do is work out what is changing in the archives ?
    – davidgo
    Mar 3, 2013 at 7:45
  • 1
    Perhaps try --atime-preserve tar option?
    – Mxx
    Mar 3, 2013 at 7:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .