list_files

list_files(path=os.getcwd(), pattern=None, recursive=False)

List all files in a directory

Parameters

Name Type Description Default
path str Path to the directory. Defaults to the current directory. os.getcwd()
pattern str a pattern to be passed on to re.match to limit the files which are found None
recursive bool Boolean, indicating to do list all files recursively to obtain files at the subdirectories False

Returns

Name Type Description
List[str] a list of files

Examples

>>> from rlike import *
>>> x = list_files()
>>> x = list_files(recursive = True)
>>> x = list_files(pattern = ".py")
>>> x = list_files(pattern = ".py", recursive = True)
>>> x = list_files(tempdir(), recursive = True)