Creating file paths
In many FileMaker Pro dialog boxes, you can specify file paths to an external file or a FileMaker data source. In most cases, each named file or FileMaker data source can consist of one or more file paths. Use multiple file paths when you want FileMaker clients 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 clients and hosts support file paths in a special FileMaker format:
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) |
|
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 |
|
Full local (Windows) |
The absolute path to a target file or folder in Windows, beginning at the top level of the file system |
|
Full remote (Windows) |
The absolute path to a target file or folder on a Windows volume shared using Windows file sharing |
|
FileMaker Network |
The network path to a shared FileMaker Pro file |
|
About path prefixes
A path prefix determines when FileMaker clients can use a specific path:
- Prefixes beginning with
file
,image
, ormovie
specify the data type of the file. Script steps that work only with specific data types requireimage
ormovie
(see below); otherwise, usefile
. - Prefixes ending with
win
,mac
, orlinux
specify the platform the path can be used on. If none of these endings are specified, the path can be used on any platform. - The
fmnet
prefix specifies a network path to a shared FileMaker Pro file.
You can use prefixes that begin with file
for any full or relative path. The file
prefix can be used on any platform.
Because it can be difficult to create multiple platform-specific paths, in many cases it’s easier to use only the file
prefix (without a platform ending) along with the Get(TemporaryPath) function or Get(DocumentsPath) function to specify a single path as a variable. At runtime, a variable path using these functions works specifically on the current client’s platform. For example, a variable defined with the following expression specifies the myfile.txt file in the client’s temporary folder:
file:" & Get ( TemporaryPath ) & "myfile.txt"
The following table lists all supported path prefixes and gives examples of where they can be used.
Path prefix |
Used for |
|
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, and script steps that work with data files |
|
Image or PDF files inserted into container fields using the Insert PDF script step or Insert Picture script step, respectively |
|
Audio/video files inserted into container fields using the Insert Audio/Video script step |
Examples of multiple file paths
When you add external data sources or use most script steps that access files, you can use multiple file paths when you want FileMaker clients to search a list of potential files. File paths are searched in the order in which they appear. A FileMaker client 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 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
Alternatively, if the Hosted folder is in both systems’ Documents folder, you can use a variable set to this expression to specify a single path that works on both platforms:
"file:" & Get ( DocumentsPath ) & "Hosted/test.xlsx"
See "Examples of using variables in file paths" below.
- Example 2: In this example for a scripted record import, a FileMaker Pro 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 clients will search for the second network file. If the second network file is also unavailable, FileMaker clients will search for the local file.
fmnet:/host1.domain.com/Databases/test.fmp12 fmnet:/host2.domain.com/Databases/test.fmp12 file:../Databases/test.fmp12
Examples of using 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:" $docsFilePath = "file:" & Get ( DocumentsPath ) & "test.xlsx" $searchList = "file:old results.txt file:../archived/old results.txt"
To |
Path list entry |
Resolved path list |
Specify a filename only |
|
|
Specify one or more directories in a path |
|
|
Specify a file in the Documents folder on any supported platform |
|
Windows: macOS: |
Specify absolute paths or relative paths, with various path type prefixes |
|
|
Specify a path type prefix dynamically or as part of a longer path |
|
|
Specify one or more complete paths |
|
|
Specify a directory (not a file) |
|
|
Notes
- To convert a path in FileMaker format to a standard operating system or URL format, use the ConvertFromFileMakerPath function—for example, to convert a FileMaker path to URL format to use in the Insert from URL script step. Conversely, use the ConvertToFileMakerPath function to convert a standard path to FileMaker format.
- 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 namedtest.xlsx
in theClients
folder on theHome
volume on themyhost
server, the path would befilemac:/Home/Clients/test.xlsx
if you mounted theHome
volume onmyhost
. - 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 host’s fully qualified domain name or use variables in file paths.
- 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 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 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.