6

If I want make a md5sum list recursively, then I would use md5deep, but it starts to pop up some problems such as it won't generate the md5sum file in alphabetical order. For example,

$ cd /media/sdcard/DCIM
$ md5deep -rl *
d41d8cd98f00b204e9800998ecf8427e 2014-12-01/IMG_1969.png
c3a9d8cb047192a03b857023948a7ba6 2014-12-01/IMG_1971.png
bd12c358db0c97230b9d48f67b2c0c98 2014-12-01/IMG_1970.png

How to solve this problem?

5

You can just pass through sort:

$ md5deep -rl * | sort -k2
d41d8cd98f00b204e9800998ecf8427e 2014-12-01/IMG_1969.png
bd12c358db0c97230b9d48f67b2c0c98 2014-12-01/IMG_1970.png
c3a9d8cb047192a03b857023948a7ba6 2014-12-01/IMG_1971.png

If your file name can contain newlines or other strangeness, use this instead (assumes GNU sort):

$ md5deep -0rl * | sort -zk2 | tr '\0' '\n'
d41d8cd98f00b204e9800998ecf8427e 2014-12-01/IMG_1969.png
bd12c358db0c97230b9d48f67b2c0c98 2014-12-01/IMG_1970.png
c3a9d8cb047192a03b857023948a7ba6 2014-12-01/IMG_1971.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.