list_filesT_list_filesListFilesListFileslist_files (算子)
名称
list_filesT_list_filesListFilesListFileslist_files — 罗列目录中的所有文件。
签名
描述
list_fileslist_filesListFilesListFilesListFileslist_files returns all files in the directory given by
DirectoryDirectoryDirectoryDirectorydirectorydirectory in the parameters FilesFilesFilesFilesfilesfiles. The current
directory can be specified with ''"""""""""" or '.'".""."".""."".". The
parameter OptionsOptionsOptionsOptionsoptionsoptions can be used to specify different
processing options by passing a tuple of values.
If OptionsOptionsOptionsOptionsoptionsoptions contains 'files'"files""files""files""files""files" only the files present in
DirectoryDirectoryDirectoryDirectorydirectorydirectory are returned. If 'directories'"directories""directories""directories""directories""directories" is
passed, only the directories present in DirectoryDirectoryDirectoryDirectorydirectorydirectory are
returned. On Unix-like systems 'symlinks'"symlinks""symlinks""symlinks""symlinks""symlinks" may be passed to list
symbolic links. Directories are marked by a trailing
'\'"\""\""\""\""\" (Windows) or a trailing
'/'"/""/""/""/""/" (Unix-like systems). If files as well as directories should be
returned, ['files','directories']["files","directories"]["files","directories"]["files","directories"]["files","directories"]["files","directories"] must be passed. If
none of 'files'"files""files""files""files""files", 'directories'"directories""directories""directories""directories""directories" or 'symlinks'"symlinks""symlinks""symlinks""symlinks""symlinks"
is passed, list_fileslist_filesListFilesListFilesListFileslist_files returns an empty tuple.
By passing 'recursive'"recursive""recursive""recursive""recursive""recursive", it can be specified that the directory tree
should be searched recursively by examining all sub-directories. On
Unix-like systems, 'follow_links'"follow_links""follow_links""follow_links""follow_links""follow_links" can be used to specify that
symbolic links to files or directories should be followed. In the
default setting, symbolic links are not dereferenced, and hence are
not searched if they point to directories, and not returned if they
point to files. The option 'follow_links'"follow_links""follow_links""follow_links""follow_links""follow_links" can not be used
in conjunction with the option 'symlinks'"symlinks""symlinks""symlinks""symlinks""symlinks".
For the recursive search, a maximum search depth
can be specified with 'max_depth <d>'"max_depth <d>""max_depth <d>""max_depth <d>""max_depth <d>""max_depth <d>", where '<d>'"<d>""<d>""<d>""<d>""<d>"
is a number that specifies the maximum depth.
Hence, 'max_depth 2'"max_depth 2""max_depth 2""max_depth 2""max_depth 2""max_depth 2" specifies that DirectoryDirectoryDirectoryDirectorydirectorydirectory and
all immediate sub-directories should be searched. If symbolic links
should be followed it might happen that the search does not
terminate if the symbolic links lead to a cycle in the directory
structure. Because of this, at most 1000000 files (and directories)
are returned in FilesFilesFilesFilesfilesfiles. By specifying a different number
with 'max_files <d>'"max_files <d>""max_files <d>""max_files <d>""max_files <d>""max_files <d>", this value
can be modified.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
DirectoryDirectoryDirectoryDirectorydirectorydirectory (输入控制) filename.dir → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Name of directory to be listed.
OptionsOptionsOptionsOptionsoptionsoptions (输入控制) string(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Processing options.
默认值:
'files'
"files"
"files"
"files"
"files"
"files"
建议值:
'files'"files""files""files""files""files", 'directories'"directories""directories""directories""directories""directories", 'symlinks'"symlinks""symlinks""symlinks""symlinks""symlinks", 'recursive'"recursive""recursive""recursive""recursive""recursive", 'follow_links'"follow_links""follow_links""follow_links""follow_links""follow_links", 'max_depth 5'"max_depth 5""max_depth 5""max_depth 5""max_depth 5""max_depth 5", 'max_files 1000'"max_files 1000""max_files 1000""max_files 1000""max_files 1000""max_files 1000"
FilesFilesFilesFilesfilesfiles (输出控制) string-array → HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Found files (and directories).
结果
list_fileslist_filesListFilesListFilesListFileslist_files 返回值 2 (
H_MSG_TRUE)
if the directory exists
and could be read.否则,将抛出异常。
可能的后继
tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelectTupleRegexpSelecttuple_regexp_select
模块
基础