#NEWLINE# def dir_size( path ) : #NEWLINE# #INDENT# exi = os . path . exists ( path ) #NEWLINE# if ( not exi ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# size = 0 #NEWLINE# for ( root , dirs , files ) in os . walk ( path ) : #NEWLINE# #INDENT# size += sum ( [ os . path . getsize ( os . path . join ( root , path ) ) for name in files ] ) #NEWLINE# #UNINDENT# return size