Extensions Reference
Extensions Reference > fsFilesystem
fsGetEnumFile
string fsGetEnumFile(int Index);
Returns the enumerated file at the specified index
The fsGetEnumFile function returns the name of the file 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 fsGetEnumFile function returns the name of the enumerated file at element N in the array.
You should use the fsFilesystem::fsGetEnumFileCount to find how many files there are in the enumerated folder, and then iterate through the entries retrieving each filename.
Parameters
Index
The file entry element number to retrieve. Specifying an invalid index (a zero based index greater than the number of enumerated files) causes the function to return an error.
Return Value
The name of the file at the specified element, or "Invalid index" if an invalid index has been specified.
Example Code
// Iterate through all of the enumerated files
for(int iFiles = 0; iFiles < fsGetEnumFileCount(); iFiles++)
{
// fsGetEnumFile() returns the name of the file at the supplied index
print "File: " + fsGetEnumFile(iFiles);
}