GNU bug report logs - #10355
Add an option to {md5,sha*} to ignore directories

Previous Next

Package: coreutils;

Reported by: "Gilles Espinasse" <g.esp <at> free.fr>

Date: Fri, 23 Dec 2011 13:47:02 UTC

Severity: wishlist

Tags: moreinfo, notabug, wontfix

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 10355 <at> debbugs.gnu.org (full text, mbox):

From: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
To: Gilles Espinasse <g.esp <at> free.fr>
Cc: 10355 <at> debbugs.gnu.org
Subject: Re: bug#10355: Add an option to {md5,sha*} to ignore directories
Date: Fri, 23 Dec 2011 16:02:43 +0100
Hi Gilles,

On 12/23/2011 02:45 PM, Gilles Espinasse wrote:
> I was using a way to check md5sum on a lot of file using
>   for myfile in `cat ${ALLFILES}`; do if [ -f /${myfile} ]; then md5sum
> /$myfile>>  $ALLFILES}.md5; fi; done
>
> But this is slow, comparing with xargs md5sum way.
> time (for myfile in `cat ${ALLFILES}`; do if [ -f /${myfile} ]; then md5sum
> /$myfile>>  ${ALLFILES}.md5; fi; done)
>
> real    0m26.907s
> user    0m40.019s
> sys     0m10.253s
>
> This is faster using xargs md5sum.
> time (sed -e '/.\/$/d' -e 's|^.|/&|g' ${ALLFILES} | xargs md5sum
>> ${ALLFILES}.md5)
> md5sum: /etc/ipsec.d/cacerts: Is a directory
> md5sum: /etc/ipsec.d/certs: Is a directory
> md5sum: /etc/ipsec.d/crls: Is a directory
> md5sum: /etc/ppp/chap-secrets: No such file or directory
> md5sum: /etc/ppp/pap-secrets: No such file or directory
> md5sum: /etc/squid/squid.conf: No such file or directory
>
> real    0m1.176s
> user    0m0.780s
> sys     0m0.400s
>
> That run mostly 30 times faster.
> In the above example, I already skipped most of the directories in the list,
> removing lines that end with / but not all directories in my list match on
> that condition.

How do you create the list of files to check?
You could use "find $DIR -type f" to list regular files only.

Erik




This bug report was last modified 13 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.