pasztora
2/19/2019 - 12:22 PM

OS functions

# A function for listing the file sizes of the files listed in FileList, the file sizes are in kB
# FileList is a list of file paths as string
def get_file_size(FileList):
    r = []
    for x in FileList:
        r.append(os.path.getsize(x) / 1024.0)
    return r

# A function for listing the names of the immediate subdirectories of a folder
def get_immediate_subdirectories(a_dir):
    return [name for name in os.listdir(a_dir) if os.path.isdir(os.path.join(a_dir, name))]