get_file_list¶
- swpy.lib.utilities.get_file_list(path, recursive=False)¶
Bring the files in
pathto the list. Generally, only files in depth 1 frompathare fetched. Ifrecursiveis True, all files in subdirectories are included in the list. The files imported into the list contain extension and directory structure information. If it fails to get the file list, it returns None. Ifpathis file, only that file is imported into the list. Since it was created based onos.scandirfunction, the hidden file is also included in the list. If you do not have permission to executeos.statfunction, you can return None even if the actual path exists.- Parameters
- Returns
list– File name list / None (Success / Fail)
Examples
>>> get_file_list("dir1/", False) ["file1.txt", "file2.txt"] >>> get_file_list("dir1/", True) [“file1.txt”, “file2.txt”, “dir2/fileA.txt”, “dir2/dir3/file_a.txt”] >>> get_file_list("dir1/file1.txt", False) [“file1.txt”]