Bcc.GetAllFilesInFolder
Bcc.GetAllFilesInFolder(Folder, IncludeSubFolders, FileFilters)
Description
This function is utilized to get a table containing all the file names contained in a folder.
This function will be used when creating a routine to process multiple files in a single directory.
Parameters
- Folder – string file path to the folder
- IncludeSubFolders - boolean value to allow searching directories contained in the folder
- FileFilters - table containing the file extension filters you wish to get.
Return
Returns a table containing the strings of each file's full filepath
Examples
--Get all of the BobCAD files from the defined folder
fileNames = Bcc.GetAllFilesInFolder("C:\\MyFolder", true, {".bbcd", ".bbcdx"})
Complete Example
--Loop through the RD Lua Test directory and display a message box with all file names
fileNames = Bcc.GetAllFilesInFolder(Bcc.GetDataFolder().."LuaPlugins\\RD Lua Test", true)
if nil ~= fileNames then
msg = "File Names:\n"
for i, name in ipairs(fileNames) do
msg = msg..name.."\n"
end
Bcc.ShowMessageBox(msg)
end