#NEWLINE# def get_free_space( folder ) : #NEWLINE# #INDENT# ' Return folder/drive free space (in bytes)\n    ' #NEWLINE# import platform #NEWLINE# if ( platform . system ( ) == 'Windows' ) : #NEWLINE# #INDENT# import ctypes #NEWLINE# free_bytes = ctypes . c_ulonglong ( 0 ) #NEWLINE# ctypes . windll . kernel32 . GetDiskFreeSpaceExW ( ctypes . c_wchar_p ( folder ) , None , None , ctypes . pointer ( free_bytes ) ) #NEWLINE# free_space = free_bytes . value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# free_space = os . statvfs ( folder ) . f_bfree #NEWLINE# #UNINDENT# LOGGER . debug ( 'Free space: %s' , free_bytes ) #NEWLINE# return free_space