Creating a custom app > Creating file paths
 

Creating file paths

You can specify file paths to an external file or a FileMaker data source. Each named file or FileMaker data source can consist of one or more file paths. Use multiple file paths when you want FileMaker Pro Advanced to search a list of potential files.

For information on adding a FileMaker data source and specifying file paths, see Connecting to external data sources.

FileMaker Pro Advanced supports the following file path formats:

 

Type of path

Description

Format

Relative

The path to a target file specified from the current database’s location or from the user’s Documents folder (see notes, below)

file:directoryName/fileName

filemac:directoryName/

filewin:../fileName

Full local or remote (macOS)

The absolute path to a target file or folder, either local or on a remote volume, beginning at the top level of the file system

filemac:/volumeName/directoryName/fileName

filemac:/volumeName/directoryName/

Full local (Windows)

The absolute path to a target file or folder in Windows, beginning at the top level of the file system

filewin:/driveletter:/directoryName/fileName

filewin:/driveletter:/directoryName/

Full remote (Windows)

The absolute path to a target file or folder on a Windows volume shared using Windows file sharing

filewin://computerName/shareName/directoryName/fileName

filewin://computerName/shareName/directoryName/

FileMaker Network

The network path to a shared FileMaker Pro Advanced file

fmnet:/hostNameOrIPaddress/fileName

Note  FileMaker Pro Advanced does not support URL protocols as file paths.

About path prefixes

The path prefix determines how FileMaker Pro Advanced interprets the rest of the path. Cross-platform prefixes work on all supported platforms but only in relative paths. For platform-specific file paths, FileMaker Pro Advanced searches only the file path that corresponds to the operating system on which the FileMaker Pro Advanced application is running.

FileMaker Pro Advanced supports the following path prefixes:

 

Path prefix

Platform support

Used for

file

Cross-platform

Importing and exporting data using the Import Records script step and Export Records script step; FileMaker data sources; files inserted into container fields using the Insert File script step

filemac

filewin

Platform-specific

image

Cross-platform

Image or PDF files inserted into container fields using the Insert PDF script step or Insert Picture script step, respectively

imagemac

imagewin

Platform-specific

movie

Cross-platform

Audio/video files inserted into container fields using the Insert Audio/Video script step

moviemac

moviewin

Platform-specific

Examples of multiple file paths

Use multiple file paths when you want FileMaker Pro Advanced to search a list of potential files. File paths are searched in the order in which they appear. FileMaker Pro Advanced opens the first file it is able to successfully locate, which completes the search. Each file path must be on a separate line.

Example 1: In this example, a FileMaker Pro Advanced database must work on two different operating systems: a Windows system and a macOS system that each accesses local files. On both platforms, the database must access a local file named test.xlsx.

filewin:/C:/ExcelFiles/Hosted/test.xlsx
filemac:/MacintoshHD/ExcelFiles/Hosted/test.xlsx

Example 2: In this example for a scripted record import, a FileMaker Pro Advanced database should access a file that is hosted. However, because the host may not be available, you also reference two alternate files, one hosted by a different server, the other stored locally on your hard drive. If the first network file is unavailable, FileMaker Pro Advanced will search for the second network file. If the second network file is also unavailable, FileMaker Pro Advanced will search for the local file.

fmnet:/192.168.10.10/Databases/test.fmp12
fmnet:/192.168.100.120/Databases/test.fmp12
file:../Databases/test.fmp12

Examples of using variables in file paths

You can use variables in file paths. Variables let you specify file or folder paths dynamically in many script steps, such as the Insert File script step and Import Records script step. See Using variables.

In the examples below, assume the following variables:

$fileName = "test.xlsx"
$username = "JohnSmith"
$targetDir = "Documents/Clients"
$chosenType = "filewin"
$$source = "file:Documents/2019/demo files"
$driveLetter = "G:"
$searchList = "file:old results.txt
     file:../archived/old results.txt"

 

To

Path list entry

Resolved path list

Specify a filename only

file:testing/$fileName

file:testing/test.xlsx

Specify one or more directories in a path

file:$username/$fileName

file:JohnSmith/test.xlsx

Specify absolute paths or relative paths, with various path type prefixes

filewin:/$driveLetter/$targetDir/contacts.txt

imagemac:../$targetDir/photo.jpg

movie:$targetDir/movie.mp4

filewin:/G:/Documents/Clients/contacts.txt

imagemac:../Documents/Clients/photo.jpg

movie:Documents/Clients/movie.mp4

Specify a path type prefix dynamically or as part of a longer path

$chosenType:/$driveLetter/$targetDir

$$source/$fileName

filewin:/G:/Documents/Clients

file:Documents/2019/demo files/test.xlsx

Specify one or more complete paths

$searchList

file:old results.txt

file:../archived/old results.txt

Specify a directory (not a file)

file:$targetDir/

$$source/

file:$targetDir/$username/

file:Documents/Clients/

file:Documents/2019/demo files/

file:Documents/Clients/JohnSmith/

Notes 

To access a file located on a shared Windows volume, use the network path format. This format is only compatible with shared Windows volumes. It is not compatible with shared macOS volumes or FileMaker Network sharing.

To access a file located on a remote macOS volume, ensure that the volume is mounted first and begin the path with filemac. For example, to export records to the file named test.xlsx in the Clients folder on the Home volume on the myhost server, the path would be filemac:/Home/Clients/test.xlsx if you mounted the Home volume on myhost.

Do not use an asterisk (*) as a wildcard character in network file paths, as it slows FileMaker network traffic. When possible, replace an asterisk with the appropriate IP address or use variables in file paths.

Use the following characters as separators in a file path list: "/", ":", or carriage return.

You can use variables in FileMaker data source references. See Editing FileMaker data sources.

If the current database is opened locally, a relative path is to a target file specified from the current database’s location. If the current database is opened remotely, a relative path is to a target file specified from:

the host’s network address, if the path is to a FileMaker Pro Advanced file (any folders in the path are ignored)

the user’s Documents folder, if the path is to a file of any other type

Access to files varies by client:

For FileMaker Pro Advanced and FileMaker Go, access to local files is limited only by the operating system.

For server-side scripts, file access is limited to the Documents folder and temporary folder. See Paths in server-side scripts.

FileMaker WebDirect, the FileMaker Data API, and Custom Web Publishing cannot access the server’s file system.