getfilepaths(*args, aspath=True, **kwargs)[source]#

Alias for sc.getfilelist() that returns paths by default instead of strings.

New version 2.1.0.

A shortcut for using glob.glob().

Note that sc.getfilelist() and sc.glob() are aliases of each other.

  • 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

  • fnmatch (str) – optional additional string to filter results by

  • 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.glob() (note: ** is required as the pattern to match all subfolders)

  • 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
sc.getfilelist(fnmatch='*.py') # Recursively find all files ending in .py
New in version 1.1.0: “aspath” argument
New in version 2.1.0: default pattern of “**”; “fnmatch” argument; default recursive=True