Skip to content

Instantly share code, notes, and snippets.

@anshultiwari1
Created August 26, 2015 13:12
Show Gist options
  • Save anshultiwari1/d0baa4618287bf7e167f to your computer and use it in GitHub Desktop.
Save anshultiwari1/d0baa4618287bf7e167f to your computer and use it in GitHub Desktop.
getting the approx size of all dependencies for a maya scene file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# getting the approx size of all dependencies for a maya scene file
import os
import sys
def size_format(size):
units = ['B', 'KB', 'MB', 'GB']
for u in units:
if size < 1024: return '%f %s' %(size, u)
size /= 1024
return '%f %s' %(size, units[-1])
def sizeFile(args):
d = '/nas/projects/Tactic/bilal/render/.depsTemp/%s.ma_filtered.lst' %args[0]
d = open(d)
sizeList = []
for dep in d:
if os.path.isfile(dep[:-1]):
sizeList.append(os.path.getsize(dep[:-1]))
print ("The approx. total size for the dependencies: ", size_format(sum(sizeList)))
d.close()
sizeFile(sys.argv[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment