ExamineDirectory()
Syntax
Result = ExamineDirectory(#Directory, DirectoryName$, Pattern$)Description
Start to examine the specified #Directory for future listing with functions NextDirectoryEntry(), DirectoryEntryName() and DirectoryEntryType().
If #PB_Any is used as '#Directory' parameter, the new directory number will be returned as 'Result'. If the result is 0, the directory can't be examined.
Once the enumeration is done, FinishDirectory() must be called to free the resources associated to the listing.
The Pattern$ specify which files must be listed. 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).
Note: when the program ends, all remaining ExamineDirectory() are finished automatically.
Example:Directory$ = "C:\" ; Lists all entries in the Windows directory (without the contents of sub-directories) If ExamineDirectory(0, Directory$, "*.*") While NextDirectoryEntry(0) If DirectoryEntryType(0) = #PB_DirectoryEntry_File Type$ = " [File] " Else Type$ = " [Sub-Dir] " EndIf Debug DirectoryEntryName(0) + Type$ + "- Size in byte: " + Str(DirectoryEntrySize(0)) Wend FinishDirectory(0) EndIf
Supported OS
All