In keeping with the principle, “Why use a screwdriver, when I have this hammer right here?”, I decided, instead of just downloading a free utility from the Mac App Store, I would build folder creation functionality using FileMaker Pro Advanced 17. With FileMaker 17’s new ability to “Create Directories” in the “Export Field Contents” step options, and an old trick to delete files from the OS, this demo file demonstrates a new and useful capability in FileMaker to create pre-defined folder structures, pretty much anywhere on your computer or related cloud directories.

Client Folder Maker
There is a nice and free alternative to building folder structures on your hard drive from the Mac App Store. It is called ‘Client Folder Maker‘.

Enter the folder names and their directory paths here.
There are three fields for each Folder.
• The Base Location
• The Folder Name
• Folder Set name.

The Folder Name field can handle three merge variables. These are:
• {Year} – the year for which you wish to generate the folders.
• {Month} – this variable generates 01-12 Month folders
• {Company} – this could be a company, organization or name.
The filter field at the top will allow users to quickly select different sets of folders.

Select where the Base Location where the folder structure will appear.
The script value list offers the following options:
• Desktop
• Documents
• Dropbox – assumes you have an account and are logged in.
• File – this will put the folder next to your FileMaker file.
• Google Drive – assumes you have an account and are logged in.
• Temporary – kind of a useless location. Not easy to get to.
More options can be added to the value list. They must be added to $BasePath variable by adding to the Case statement in the Create Folder Structure script.
Merge fields are entered here, {Year}, {Month}, {Company}.
There are two merge variables created in the dialog box, one for Year and another for Company. If you enter a Month variable, 12 monthly folders will be generated using a loop. All are merge variables are optional. More merge variables could be added as needed. Alternatively, these variables could be determined, rather than in the dialog box, from another data table. For example Company could come from a Customer database, Year could be generated by the Current Year or the Current Year plus 1, etc.

The Test File.See the update at the bottom.
There is a test file PDF stored in the Settings popover. This small file is just there to create the folders. Once the folder is created, the file gets deleted. You can put your own file in here, but it won’t make any difference, because if all is working well, no one will ever see this file.

Create Folder Structure script.
Two FileMaker 17 features are required for this script. The most important is the Export Field Contents – Create Directories option turned on.
The second feature is not as essential, but nice to use, the ability to create a variable directly from a dialog box.
A key concept here is that we are using the FileMaker 17 ability to create a directory to place a file and then using an older FileMaker ability to delete the small test file right after it is created by Exporting Field Contents again, but this time, not selecting a field. FileMaker overwrites the file with ‘nothing’ and it gets deleted.

Key Step to Deleting the Temporary File
The second Export Field Contents does not specify a field, so it is empty and exports to the file name, Deleting it from the folder.

Setting Variables from a dialog box.
Thank you FileMaker Inc. This feature was a long time coming and we are grateful that it has arrived.

Folders created in the required location.
The end result of this script is a batch of folders created on the Desktop, or other Base Locations. As you can see, this is a fairly useful idea and could be adapted to a FileMaker workflow, wherever you need a folder structure built, either annually, or monthly or for a specific company.
Update 2018-12-12: At 5 am, the morning after posting this idea, while supposedly sleeping, apparently my brain was still processing a bit in the background and it occurred to me to test running the script without exporting the test file. Instead, just using a single Export Field Contents with no field specified and ‘Create Directories’ turned on, I found that it works! Presumably FileMaker’s function is creating the directories, before it checks to see if there is an actual file to export. This makes the script a little simpler, presumably a bit faster and no files are deleted in the process. I have updated the demo file, getting rid of the File container field for export and shortening the scripts by a line or two.
Really nice technique, thank you.
Hammers = more fun
Nice work Douglas (as always) and thanks for sharing it !
Just a question, is there a way with FileMaker to know the content of a folder (file names and/or folder names) ?
And last but not least …
Merry Christmas !
Not that I know of. You could probably AppleScript it, but nothing FileMaker native…