Created
May 14, 2012 05:27
-
-
Save cryks/2691931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env gosh | |
(use gauche.generator) | |
(use rfc.md5) | |
(define (main argv) | |
(let ([lis (make-hash-table 'string=?)]) | |
(dolist [file (filter file-is-regular? (glob "md5/*.md5"))] | |
(do-generator [line (file->line-generator file)] | |
(rxmatch-case line | |
[#/^([^ ]+) (.*)$/ (#f md5) | |
(hash-table-push! lis md5 file)]))) | |
(dolist [file (filter file-is-regular? (glob "files/**/*"))] | |
(let* ([md5 (digest-hexify (with-input-from-file file md5-digest))] | |
[lis (ref lis md5 '(" "))]) | |
(print #`",(last (sort lis)) ,file (,(length lis))"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment