BE_ListFilesInFolder

BE_ListFilesInFolder ( path {; type ; includeSubdirectories ; useFullPath } )

 

Lists the contents of a folder at the path, both files and folders by default or use a type from BE_FileType_All, BE_FileType_File, or BE_FileType_Folder. 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

Version : 1.2 : Added the optional type parameter.

Version : 2.3 : Added the optional includeSubdirectories and useFullPath parameters.

 

Notes:

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.

 

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

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Ian Renwick

    Hi Nick, 

    This is doing 'more' than what I need ... it also lists e.g. 'invisible' temporary MS Word files that show up as files replacing the original file name's first 2 letters with "~$" (see value 3 below). This occurs when the original file is open (see value 1 below). It also lists invisible ".DS_Store" files which can happen when a file is moved from a folder and is no longer part of the folder contents (see value 2 below).

    I can obviously rework my list using calculations but thought an extra parameter to show invisible files with a True/False value would be helpful. A future feature?

    Regards, Ian Renwick

     

Article is closed for comments.