Brian Dunning's FileMaker Custom Functions

GetDocumentsFolderFileList ( folderName )

Gets List of File Paths for Files in a Folder within the Documents Directory

  Be the first to rate this function Log in to vote

Justin Hesser   Justin Hesser - Show more from this author
Kyo Logic LLC
https://kyologic.com

Share on Facebook Share on Twitter

  Sample input:
GetDocumentsFolderFileList ( "FileMaker_Uploads" )
  Sample output:
/Macintosh HD/Users/user1/Documents/FileMaker_Uploads/File1.pdf
/Macintosh HD/Users/user2/Documents/FileMaker_Uploads/File2.jpg

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function pulls the list of files in a folder within the computer's Documents Directory. This list can then be used to insert the files from that folder into container fields.

 

Comments

Pierre von Kaenel   Pierre von Kaenel
Feb 25, 2022
Maybe I'm missing some detail, but in testing this cf, I entered a folder name in my Documents folder (Mac) put in quotes. I use this to assign its return text value to a field in my test DB. When run, it freezes FM 19 every time. I need to do a Force Quit to exit the app.
 
Pierre von Kaenel   Pierre von Kaenel
Feb 25, 2022
The same happens if I try assigning the return value to a variable. I even used a different folder in my Documents folder. Same result.
 
Justin Hesser   Justin Hesser, Kyo Logic LLC
Feb 25, 2022
It is most likely caused by your Documents folder having more than 30,000 character's worth of File Names. The custom function first runs the Get (DocumentsPathListing), which pulls in the names of all of the files in your Documents Folder.
 
Pierre von Kaenel   Pierre von Kaenel
Feb 25, 2022
The same happens if I try assigning the return value to a variable. I even used a different folder in my Documents folder. Same result.
 
Pierre von Kaenel   Pierre von Kaenel
Feb 25, 2022
When you say 30,000 - is that file names just in the home Documents folder or does it include all files in all subfolders?
Ps: forgive the repost above, I just refreshed the page and that seems to have reposted my second post.
 
Justin Hesser   Justin Hesser, Kyo Logic LLC
Feb 25, 2022
It is most likely caused by your Documents folder having more than 30,000 character's worth of File Names. The custom function first runs the Get (DocumentsPathListing), which pulls in the names of all of the files in your Documents Folder.
 
Justin Hesser   Justin Hesser, Kyo Logic LLC
Feb 25, 2022
It takes in all files on the Documents folder, including those in subfolders.
 
Pierre von Kaenel   Pierre von Kaenel
Feb 25, 2022
I have 215 folders and documents in the home Documents folder, so those would not add up to 30,000 chars. If the figure includes subfolders and their nested files, then maybe over 30,000.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 18 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: