Extensions Reference
Extensions Reference > fsFilesystem
fsEnumFolderAppend
int fsEnumFolderAppend(string Folder);
Enumerates the specified folder and appends results to cache
The fsEnumFolderAppend function enumerates the specified folder and caches the files and subfolders within it for future use. Unlike fsEnumFolder, this function does not erase the cache before enumerating the files and folders. Therefore this function is ideal for caching multiple patterns of files. For example, if you wish to enumerate C:\test\*.jpg and C:\other\*.gif, you would call fsEnumFolder for C:\test\*.jpg then fsEnumFolderAppend for C:\other\*.gif. You can then use fsGetEnumFile to retrieve the files.
You may repeatedly call this function to enumerate as many folders and patterns as required. The limit is the number of entries that can be stored in system memory.
Note: When using fsEnumFolderAppend, fsGetEnumFileCount and fsGetEnumFolderCount always return an accurate count of enumerated files. Therefore you can safely rely on these functions to return the current count of cached files and folders regardless of how many fsEnumFolder and fsEnumFolderAppend calls are made.
Parameters
Folder
The folder to enumerate. This may be a path and folder without a trailing backslash (eg: "C:\TestFolder" and "C:\TestFolder\" are both legal). This may also be a wildcard pattern search ("C:\Test\*.bmp").
Return Value
The total number of files and subfolders in the specified folder. Note that this is the count of enumerated files and folders cached by this specific call to fsEnumFolderAppend, not a total count of enumerated files and folders that includes any previous call to fsEnumFolder or fsEnumFolderAppend. To retrieve the total counts, use fsGetEnumFileCount and fsGetEnumFolderCount.
Example Code
// iTotal contains the number of files and subfolders in the root of C:
int iTotal = fsEnumFolder("C:\\");
// iTotal2 contains the number of files and subfolders in the root of D:
int iTotal2 = fsEnumFolderAppend("D:\\");
// At this point any call to fsGetEnumFile or fsGetEnumFolder will be
// able to retrieve anything in C:\ or D:\