list_files

list_files(path=None, pattern=None, recursive=False)

List all files in a directory

Parameters

Name Type Description Default
path Union[str, None] Path to the directory. Defaults to the current directory if not provided None
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)