I am writing a little script the modifies some movies in a directory tree, and I would like to parse that tree with a bash for loop or similar.
So I started to find the files with
find -iname *.mov -or -iname *.mkv -or -iname *.avi
and he shows me some files of each kind just as expected.
But then I try to loop over the result with this (since there is whitespace in some of the dir names).
find -iname *.mov -or -iname *.mkv -or -iname *.avi -print0 | while read -d $'\0' line
do
echo $line
done
But now he only returns the avi files! So it seems like when I add the -print0 he ignores my -or and the other -iname.
What is going on here, what am I missing?
Do I need to send the result from find into a tmpfile before looping over the result?