DirectoryReader
This object is used to build a list of files and directories matching various criteria.
Constructor
DirectoryReader()
Create a new object used for building lists of files
- local dir_reader = DirectoryReader()
Methods
:BuildDirectoryList(string dir_path, bool recurse)
Build a list of directories we will search for files
- dir_path (string) path to build list of files from
- recurse(bool) if true include sub directories as well
:ClearDirs()
Clear list of directories
:ClearFiles()
Clear list of files
:DirAtIndex(integer index)
Returns: (DirectoryEntry for directory at passed index index (integer) index of directory entry to get. Entries are indexed from 1 to:NumberOfDirs()
:FileAtIndex(integer index)
Returns: (FileEntry for file at passed index index (integer) index of file entry to get. Entries are indexed from 1 to:NumberOfFiles()
:GetFiles(string filter, bool include_files_in_list, bool include_dirs_in_list)
Add files or directories matching passed filter to list held by this object. Note this method can be called multiple times to add different sets of files
- filter (string) Filter (eg "*.dxf") to use for finding matching files
- include_files_in_list (bool) if true we collect names of matching files
- include_dirs_in_list (bool) if true we collect names of matching directories
:SortDirs()
Sort list of directories into alphabetical order
:SortFiles(integer sort_order, bool reverse)
Sort list of files into order
- sort_order (integer) Sorting algorithm to use, options are
- DirectoryReader.SORT_NONE
- DirectoryReader.SORT_ALPHA
- DirectoryReader.SORT_WRITE_DATE
- DirectoryReader.SORT_SIZE
- reverse(bool) if true sort in reverse order
- sort_order (integer) Sorting algorithm to use, options are
:NumberOfDirs()
Returns: (the number of directories found
:NumberOfFiles()
Returns: (the number of files found
References
Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 10.0, published August 21, 2019. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information