ExamineDirectory()
语法
Result = ExamineDirectory(#Directory, DirectoryName$, Pattern$)概要
Start to examine a directory for listing with the functions NextDirectoryEntry(), DirectoryEntryName() and DirectoryEntryType().
参数
#Directory A number to identify the new directory listing. #PB_Any can be used as a parameter to auto-generate this number. DirectoryName$ The directory to examine. Pattern$ A pattern to filter the returned entries by. For example: A 'Pattern$' like "*.*" or "" will list all the files (and sub-directories) in the directory. A 'Pattern$' like "*.exe" will list only .exe files (and sub-directories ending with .exe if any).
返回值
Returns nonzero if the directory can be enumerated or zero if there was an error. If #PB_Any was used as the #Directory parameter then the generated directory number is returned.
Remarks
Once the enumeration is done, FinishDirectory() must be called to free the resources associated to the listing.
示例
Directory$ = GetHomeDirectory() ; Lists all files and folder in the home directory If ExamineDirectory(0, Directory$, "*.*") While NextDirectoryEntry(0) If DirectoryEntryType(0) = #PB_DirectoryEntry_File Type$ = "[File] " Size$ = " (Size: " + DirectoryEntrySize(0) + ")" Else Type$ = "[Directory] " Size$ = "" ; A directory doesn't have a size EndIf Debug Type$ + DirectoryEntryName(0) + Size$ Wend FinishDirectory(0) EndIf
参阅
FinishDirectory(), NextDirectoryEntry(), DirectoryEntryType(), DirectoryEntryName(), DirectoryEntrySize(), DirectoryEntryAttributes(), DirectoryEntryDate()
已支持操作系统
所有