Extensions Reference
Extensions Reference > fsFilesystem
fsGetEnumFolder
string fsGetEnumFolder(int Index);
Returns the enumerated folder at the specified index
The fsGetEnumFolder function returns the name of the folder at the specified enumeration index. Before calling this function you must call fsFilesystem::fsEnumFolder, which performs the actual setup and enumeration of the specified folder.
fsFilesystem::fsEnumFolder enumerates the files and subfolders in a folder and places them in an array corresponding to their entry order in the enumerated folder, for example a file named AAA.doc would be at element 1, AAB.doc at element 2 etc. The fsGetEnumFolder function returns the name of the enumerated subfolder at element N in the array.
You should use the fsFilesystem::fsGetEnumFolderCount to find how many subfolders there are in the enumerated folder, and then iterate through the entries retrieving each folder name.
Parameters
Index
The folder entry element number to retrieve. Specifying an invalid index (a zero based index greater than the number of enumerated subfolders) causes the function to return an error.
Return Value
The name of the folder at the specified element, or "Invalid index" if an invalid index has been specified.
Example Code
// Iterate through all of the enumerated subfolders
for(int iDirs = 0; iDirs < fsGetEnumFolderCount(); iDirs++)
{
// fsGetEnumFolder() returns the name of the folder at the supplied index
print "Dir: " + fsGetEnumFolder(iDirs);
}