On Tue, Jul 07, 2009 at 12:08:05AM -0400, Scott Gifford wrote: > Ron Johnson <ron.l.john...@cox.net> writes:
> You will need to figure out what metadata you care about and what you > don't, then. For example, do you want to detect a renamed file? A > change in mtime/ctime/utime? A change in permissions? > > For the file contents, if there are no subdirectories you can use: > > cat `ls` |sha1sum Which is basically: cat * | sha1sum And it would still fail to detect the difference between: case 1: seq 1 6 >file1 case2: seq 1 3 >file1 seq 4 6 >file2 (Same content, different metadata) > > ls will sort the files, so they will end up in the same order every > time. > > For metadata, you could come up with the flags to ls that give the > metadata you want, then include that before or after the cat, like > this: > > (ls -l; cat `ls`) |sha1sum Same comment about echo *. Also note that packing files together with their metadata is, in fact, exactly what an archive utility does: tar cf - . | sha1sum This will also pick hidden files and subdirectories. Oh, and sha1sum is not the only checksum available: $ ls /usr/bin/*sum /usr/bin/cksum /usr/bin/lh_source_md5sum /usr/bin/sha384sum /usr/bin/innochecksum /usr/bin/md5sum /usr/bin/sha512sum /usr/bin/jacksum /usr/bin/sha1sum /usr/bin/shasum /usr/bin/kmk_md5sum /usr/bin/sha224sum /usr/bin/sum /usr/bin/lh_binary_md5sum /usr/bin/sha256sum Some of those are actually relevant :-) -- Tzafrir Cohen | tzaf...@jabber.org | VIM is http://tzafrir.org.il | | a Mutt's tzaf...@cohens.org.il | | best ICQ# 16849754 | | friend -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org