0

Let's say I have a directory with 5 video files in it. How can I measure the total duration of all video files in this directory from terminal. Also, I want to be able to do this recursively to any subdirectories it may has. I don't want to use VLC or any other GUI tools, since I've many directories to perform this action on, and it take a lot of time for me to do it.

6
  • Welcome to Super User! What have you tried so far? What research have you done? :)
    – bertieb
    Jul 15, 2018 at 19:07
  • @djsmiley2k Thanks for the help. The first answer on that thread solves my problem for a single directory. However, most of my directories have subdirectories with video files. Can you please explain, how to do it recursively for subdirectories? I used this command: exiftool -S -n ./*.mp4 | awk '/^Duration/ {print $2}' | paste -sd+ -| bc Jul 15, 2018 at 19:32
  • 2
    -1. Feedback: your question shows no research effort and this comment continues with the attitude: "Can you please explain, how to do it recursively for subdirectories?" Learn how the linked answer works (man find is your friend): what -maxdepth is, what -exec is. Experiment. Edit the question and tell us what exactly you have tried, where you are stuck. Not knowing is not a shame, nor is failing; but not trying is. Jul 15, 2018 at 19:53
  • 1
    Technically you don't have to. You can do no research and still get some answers sometimes and some downvotes often. I'm giving you a feedback on where these downvotes come from, plus an advice on what to do to avoid them. Jul 15, 2018 at 20:58

1 Answer 1

1

As noted in comments, the command from anotehr thread works for a single directory, but not multiple subdirectories.

This command will use find to get files from all subdirectories (ending in .mp4)

find ./ -name *.mp4 -exec exiftool -S -n {} \;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .