I ran into a situation that I don't really understand. I have a bunch of backup files in a recursive structure of which I want to calculate the md5. When I add some additional file extensions the process exits (exit code 0) without yielding any output.
find . -type f -iname "*.3gp" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mp4" -print0 | xargs -0 md5sum
find . -type f -iname "*.3gp" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mp4" -o -iname "*.mpg" -print0 | xargs -0 md5sum
The first one works fine, the second one doesn't yield any output. I've even tried it in a directory where there are no mpg files, same behavior.
Is there a limit on the number of arguments to find? I am running OSX and I installed md5sum from Macports.
Extra information
There seems to be something odd with the pipe and I'm inclined to blame the filenames. Further investigation in another folder shows me that the find command seems to work and there are 129 video files, 1 of which is .mpg. When I try the find+md5sum it returns after only 1 file. I ran a similar command in other folder that only contains pictures and it worked fine (found 80k files, yield 80k hashes).
Pictures@2006$ find . -type f -iname "*.3gp" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mp4" | wc -l
128
Pictures@2006$ find . -type f -iname "*.3gp" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mp4" -o -iname "*.mpg" | wc -l
129
Pictures@2006$ find . -type f -iname "*.3gp" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mp4" -o -iname "*.mpg" -print0 | xargs -0 md5sum
c21a78f2b2d5ca773b47647315ad91f8 ./pending photos/Video [%]/P007.MPG
Pictures@2006$
I also noticed that the second filename to process contained punctuation, a plus sign and non-ascii characters. Is it possible that the error may be due to file naming? Is there any workaround?
/Esplai/+Nou/20060604 Dinar d'últim dia d'esplai[Barbacoa al torrent de l'Escaiola]/MVI_7702.AVI
find
by itself (without-print0
and without piping intomd5sum
)? – dhag Sep 11 '15 at 18:13