BE_FileListFolder ( path {; type ; includeSubdirBoolean ; useFullPathBoolean ; includeHiddenBoolean } )

Lists the contents of a folder at the path, both files and folders by default or use a type from BE_FileTypeAll, BE_FileTypeFile, or BE_FileTypeFolder. With the includeSubdirectories parameter set to true, it will recursively go into every sub folder and return all the results it finds. useFullPath will change the output to include full paths instead of just filenames.

Version : 1.1
1.2.0 : Added the optional type parameter.
2.3.0 : Added the optional includeSubdirectories and useFullPath parameters.
4.0.0 : Added the optional includeHidden parameter.
4.1.3 : Correctly handle file names containing Unicode Characters on Windows


The includeSubdirectories option means that it will try every single subfolder.  Be cautious when using this as it may take a long time to traverse all the sub folders.  

Also it is more than likely that at some point it will throw an error as it will come across a folder or file it doesn't have access to.  Then the function will stop and return error 13, and no data.  Managing individual errors like that amongst a potentially large set of files is beyond the scope of this function as implemented.

If you're getting error 13 when using this flag, consider doing without it and traversing the sub folders via script or recursion and ignoring the access error codes instead.

Parameters : 

path : a system file path.
type ( optional ) : The type of files required, either Files, Folders or both. Default is to files only. Use the functions BE_FileType_All, BE_FileType_File and BE_FileType_Folder to request specific types.
includeSubdirectories ( optional ) : A True or False value, defaults to False. When True will scan sub directories as well.
useFullPath ( optional ) : A True or False value, defaults to False. When True will include the full path to the file, or False will just be filenames.
includeHidden ( optional ) : A True or False value, defaults to True. When True will include the hidden files in the return value.

Result : a return separated list of file names. Returns a ? if the path is invalid, or other errors occurred.

Note that the path passed to the plugin ( eg "C:\Folder" ) and the resulting list can be combined into a single string to get the full path.  So the file list may be leading folder separators in it ( eg "\file.txt" ).  This is just how the operating system works, not a function of the plugin itself.

If you wanted to remove the leading character you can do this with regex : BE_RegularExpression ( $fileList ; "."; "v" ; "" ) 

Examples :

BE_FileListFolder ( BE_FolderSelectDialog ( "" ) )

BE_FileListFolder ( "/Users/nick/Desktop" )

BE_FileListFolder ( $path ; BE_FileType_Folder ; False ; True ; True )
//So this last one will start at $path, but only return folders, and will not include subdirectories, will return a full path not just the folder names, and will include any hidden folders. :

BE_FileListFolder ( $path ; BE_FileType_Folder ; 
False ; //don't scan sub folders
True ; //include a full path
True ) //include hidden files

Still need help? Contact Us Contact Us