def filelist(folderpath, ext=None):
if not ext:<EOL><INDENT>ext = []<EOL><DEDENT>if os.path.exists(folderpath) and os.path.isdir(folderpath):<EOL><INDENT>return [ os.path.join(folderpath, f) for f in os.listdir(folderpath) if os.path.isfile(os.path.join(folderpath, f)) and os.path.splitext(f)[<NUM_LIT:1>] in ext ]<EOL><DEDENT>else:<EOL><INDENT>log.warn('<STR_LIT>'.format(folderpath))<EOL><DEDENT>
Returns a list of all the files contained in the folder specified by `folderpath`.
To filter the files by extension simply add a list containing all the extension with `.` as the second argument.
If `flat` is False, then the Path objects are returned.