import os import platformimport ctypes def get_free_space(folder): """ Return folder/drive free space (in bytes) """ if platform.system() == 'Windows': free_bytes = ctypes.c_ulonglong(0) ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder),
None, None,
ctypes.pointer(free_bytes))
return free_bytes.value else: return os.statvfs(folder).f_bfree if __name__ == "__main__": path = (r"network drive") print get_free_space(path) This prints the free space as bytes. It is cross platform and will work on both Linux,MaxOS and Windows. Enjoy