Calculating the Size of Your Video Library
2016 December 07

This command will calculate the size of your movie and video library in days. You can modify the awk command as you see fit to calculate the time lengths.

The find command will find all movie files in that directory and the sed command filters it out.

find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p' |
while read line ;
    do ffprobe -i "$line" -show_entries format=duration -v quiet -of csv="p=0"
done > times
awk '{s += $1} END { print int(s) / 3600 / 24 }' times

This command does not work on mac, due to them using a different version of file that returns a different format for what the file is.

Remember you can also subscribe using RSS at the top of the page!

Share this on → Mastodon Twitter LinkedIn Reddit

A selected list of related posts that you might enjoy:

Written by Henry J Schmale on 2016 December 07
Hit Counter