Re: how to write a script that recursively check files in a directory with md5sum
John Summerfield <debian@ComputerDatasafe.com.au> writes:
> Since he specifically said he wants to use mdsum, it's clearer to use
> the program he said he wants to use.
>
> Try it and see what happens.
[19:24:27] wesley:~/tmp/t $ ls -l
total 4
-rw-r--r-- 1 ats ats 2344 2004-07-14 19:23 a b c d
[19:24:29] wesley:~/tmp/t $ find . -type f -exec md5sum '{}' \;
7b36fd049b94da0d04fbe0e932704e6b ./a b c d
In other words, it works fine.
> The problem is that fragments of file names separated by spaces are
> indistinguishable from filenames separated by spaces.
No, they aren't. -exec calls one of the exec(3) functions, which
don't need to reparse a string to determine arguments. If the
command run by -exec is a normal binary command, or a shell script
coded carefully, -exec is perfectly functional.
Piping the output to xargs is another thing, since things need be
reparsed, which is why -print0 and -0 exist in find and xargs....
--
Alan Shutko <ats@acm.org> - I am the rocks.
You're a Bundle of Laughs: Vera Funny
Reply to: