Skip to content

Instantly share code, notes, and snippets.

@milothiesen
Last active June 29, 2016 15:41
Show Gist options
  • Save milothiesen/c8ee703bf931e504c7d0 to your computer and use it in GitHub Desktop.
Save milothiesen/c8ee703bf931e504c7d0 to your computer and use it in GitHub Desktop.
A script to find the total size of all prores files in a given directory.
#developed by Sam Heinith and Maile Thiesen
#!/usr/bin/ruby
# in terminal, the path to check must be in quotes! EX. (mailethiesen$ ruby total_pro_res_size.rb "/Volumes/Drobo\ \#7\ 2014/AMNH\ Video/2014/2014-01-07\ Pterosaurs ")
library_path = ARGV[0]
files_list = %x[find #{library_path} -name "*.mov"].split("\n")
total_prores_size = 0
total_other_size = 0
files_list.each do |filename|
filename.chomp!
mediainfo_output = %x[mediainfo '#{filename}']
filesize = File.size(filename)
if mediainfo_output =~ /prores/i
puts filename + " matches prores" + " filesize = " + filesize.to_s
total_prores_size += filesize
else
total_other_size += filesize
end
end
puts "Total Prores: #{total_prores_size/(1024**3)} GB"
puts "Total Other: #{total_other_size/(1024**3)} GB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment