I'm using Python 2.7 to monitor disk usage of some application running on Windows 2012 server. How can I get a size of some network storage folder located for example here:
\\storage\my_folder\
I've tried to use (from this post: calculating-a-directory-size-using-python ):
import os
def getFolderSize(folder):
total_size = os.path.getsize(folder)
for item in os.listdir(folder):
itempath = os.path.join(folder, item)
if os.path.isfile(itempath):
total_size += os.path.getsize(itempath)
elif os.path.isdir(itempath):
total_size += getFolderSize(itempath)
return total_size
but of course network path is not supported.