getfilelist(folder=None, pattern=None, abspath=False, nopath=False, filesonly=False, foldersonly=False, recursive=False, aspath=None)[source]

A shortcut for using glob.

  • folder (str) – the folder to find files in (default, current)

  • pattern (str) – the pattern to match (default, wildcard); can be excluded if part of the folder

  • abspath (bool) – whether to return the full path

  • nopath (bool) – whether to return no path

  • filesonly (bool) – whether to only return files (not folders)

  • foldersonly (bool) – whether to only return folders (not files)

  • recursive (bool) – passed to glob()

  • aspath (bool) – whether to return Path objects


List of files/folders


sc.getfilelist() # return all files and folders in current folder
sc.getfilelist('~/temp', '*.py', abspath=True) # return absolute paths of all Python files in ~/temp folder
sc.getfilelist('~/temp/*.py') # Like above

New in version 1.1.0: “aspath” argument