I have a folder named tutorials. Inside it, there are about 15 folders each containing about 15-20 .mp4 video files. I want to get the total duration of all the files present in the folder tutorials. This is the code I have written so far:
for d in ~/Videos/tutorials/*; do
if [ -d "$d" ]; then
exiftool -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)}' ./*.mp4| tail -n1
fi
done
The above code, when executed, gives an error File not found: ./*.mp4 for each of the subfolders present inside tutorials. However, when the line
exiftool -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)}' ./*.mp4| tail -n1
is executed individually inside each sub-folders, I am able to get the correct output.
What changes should I make in the above code to get it working?