One of the great strengths of FileMaker is the ability to export data to a user’s computer in a variety of formats. With FileMaker 16 and earlier, a developer had limited choices as to where the export files would be saved. One could set a variable with the user’s Desktop path, or the path to the temporary folder, or hard code in an expected path. With all of these options, the directory (i.e., folder) had to already exist. One could not create a new directory as part of the scripted export.

This has changed in FileMaker Pro Advanced 17, allowing much-improved organization of scripted exports. Now, when you specify the path, exporting script-steps will create a new directory if it doesn’t already exist. You can even create nested directories.

As with previous versions, you cannot export a file to a location that the user does not have permission to modify–for example, the root level of the user’s hard drive. As would be expected, you also can’t make a new directory in locations where the user doesn’t have permission.

The ability to create a directory is now a part of the following script steps:

  • Export Field Contents
  • Export Records
  • Save Records As Excel
  • Save Records As PDF
  • Save Records As Snapshot Link
  • Save a Copy As.

When using one of these script steps. You’ll see a new feature, “Create directories: on/off.” You simply turn on create-directories and include the name of the new directory in the path when specifying the output file.

In the example below, the Export Records script step will result in the file being saved to a new folder, named “NewFolder,” inside of the Shared folder.

For new subfolders, just keep adding to the path after the new folder, including slashes (“…/NewFolder/NewFolder2/NewFolder3/…”)

Create Directories Via Script Step With FileMaker 17


Also published on Medium.

Dan

Dan – Software Engineer

Dan has been developing FileMaker solutions since FileMaker Pro version 2 and has over 20 years experience supporting Apple technologies. He served as an IT Director for a Macintosh-based business and as an Apple Store Genius.