FileMaker 17 has a new feature which allows you to automatically create directories in a file path if they don’t exist!

In previous versions, you would have to trust users to pre-create the directory, use a plugin or use a system script to ensure that the proper folder was in place in order to export to.

In my scenario, I want to save a PDF of a layout to a folder on my desktop called “PDFS.” As you can see that folder does not exist.

Automatically Create Directories in a File Path

In previous versions, if the folder is not available when you export, you would get this panic-inducing error:

Error in FileMaker 16

FileMaker 17 allows us to ensure the directory is always there with the “Create Directories” option in the Save/Send As Script Step.

Automatically Create Directories in a File Path in FileMaker 17

In this script, I set my Export path to the variable “$path” and designate the PDF to go to a folder on the Desktop, called PDFS.  In the Save Records as PDF Script Step, note that Create directories is ON.

Example of How to Automatically Create Directories in a File Path

After I run the script, I now have a folder on my Desktop called PDFS and my file is stored. If the folder exists, FileMaker will simply save the file without overwriting the directory. You are not limited to 1 sub-folder. I have adjusted my path to include a subfolder for today’s date:

Path to Include Date

And my result is:

Result for Automatically Create Directories in a File Path

And that’s how you automatically create directories in a file path. Yet another great improvement without having to utilize a plugin!

—Justin Redden