Last active
May 23, 2016 11:39
-
-
Save anshultiwari1/00965b0b13cd13d9fadb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# getting the total size of all dependencies for a maya scene file | |
import os | |
import sys | |
import glob | |
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) | |
counter = 0 | |
sizeList = [] | |
for dep in d: | |
for fil in glob.glob(dep[:-1]): | |
sizeList.append(os.path.getsize(fil)) | |
counter += 1 | |
print ("The total size for the " + str(counter) + " 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