I used to get my result in windows by just searching *.mp4 and select all files. The sum of duration would show in side panels details. I want to find the same things inside MAC recursively. This is the script I wrote in bash. Tell me what I am doing wrong?
#!/bin/bash
sum=0
find . -type f -name "*.mp4" | while read line; do
duration=`mdls -name kMDItemDurationSeconds "$line" | cut -d "=" -f 2`
sum=$(echo "$duration + $sum"|bc)
all=$sum
done
echo $all