GNU bug report logs -
#10355
Add an option to {md5,sha*} to ignore directories
Previous Next
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
View this message in rfc822 format
----- Original Message -----
From: "Bob Proulx" <bob <at> proulx.com>
To: "Gilles Espinasse" <g.esp <at> free.fr>; <10355 <at> debbugs.gnu.org>
Sent: Friday, December 23, 2011 6:17 PM
Subject: Re: bug#10355: Add an option to {md5,sha*} to ignore directories
> severity 10355 wishlist
> tags 10355 + notabug wontfix moreinfo
> thanks
>
> Erik Auerswald wrote:
> > 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
> >...
> > You could use "find $DIR -type f" to list regular files only.
>
Thank for the suggestion.
ALLFILES is indirectly made using find $DIR, but I can't use -type f during
that find.
The primary usage of that list is to create a tar using --files-from and
when a directory is empty, you need to include the directory name directly.
> Yes. Exactly. The capability you ask for is already present.
>
> Please try this:
>
> find . -type f -exec md5sum {} +
>
> Replace '.' above with a directory if you wish it to find files in a
> different directory.
>
> Bob
This does not work too in my case.
I didn't want to calculate md5 for each file found in my chroot.
I care only for a shorter list of files to be include in a tar.
The only change I find is derived from the slow version, but instead of
running md5sum each time, adding true file names to a list that md5sum will
only use at the end:
rm /tmp/ALLFILES*
time (for myfile in ${ALLFILES} | sed -e 's/^dev.*//' -e 's/^sys.*//'); do
if [ -f /${myfile} ]; then echo /$myfile >>/tmp/ALLFILES; fi; done; xargs
md5sum < /tmp/ALLFILES >/tmp/ALLFILES.md5)
real 0m1.967s
user 0m1.368s
sys 0m0.604s
This is approximatly 100% slower than the fast version but does not need
hiding errors (from directory message and program status). That's fast
enought for my need and divide by 5 the time from the first slow version.
Gilles
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.