Pattern: File path

“File path” is one of the patterns that you can select on the Match panel. With this pattern you can match a file path on a Windows or UNIX file system. Linux and macOS use UNIX file systems.

Root Directory

Allow a path that starts with a backslash to make it relative to the root of the current drive on Windows or a path that starts with a forward slash to make it an absolute path on a UNIX-style file system as used by MacOS and Linux.

Path Relative to Home Folder

Allow a path that starts with a tilde to make it a path relative to the user’s home folder on a UNIX-style file system as used by MacOS and Linux.

Relative Path

Allow a path that is implicitly relative to the current directory. Such a path does not specify a drive letter, network share, or root folder.

Path Relative to Current Directory

Allow a path that starts with a dot and a slash to make it explicitly relative to the current directory on a UNIX-style file system as used by MacOS and Linux.

Backslashes

Allow the path to use backslashes to delimit folders.

Forward Slashes

Allow the path to use forward slashes to delimit folders.

Case insensitive

Turn on to make lists of drives, folders, file names, and extensions case insensitive. File paths are case insensitive on Windows.
Turn off to make lists of drives, folders, file names, and extensions case sensitive. File paths are case sensitive on UNIX-based systems such as Linux.

Allow Whitespace

This option determines whether folders and file names can contain whitespace when those are set to “allow any path”, “allow any file name”, or “ASCII characters only”. The option “1 to 8 ASCII characters” never allows whitespace. When you specify a list of specific paths, folders, or file names, the list itself determines whether any whitespace is allowed in that part of the path.

Drive or Network

On Windows, absolute file paths start with a drive letter in the form of C:\ or with a UNC network share in the form of \\SERVER\SHARE\. You can choose whether or not to allow file paths that start with a drive letter or network share.

Specific Drive Letters or Network Shares

If you select to allow specific drive letters or network shares then you can enter them here, one per line.

This box is a full-featured text editor. You can cut, copy and paste with Ctrl+X, Ctrl+C and Ctrl+V as usual. Press Enter to insert a line break.

If the field validation mode is set to “none” or “loose” and you specify multiple network shares then the list only determines which characters are allowed in network shares. To make the regex actually check for the whole list, set the field validation mode to “average” or “strict”. Drive letters are always matched accurately.

Minimum Number of Parent Folders

A path that starts with ..\ is relative to the parent of the current folder. A path that starts with ..\..\ is relative to the parent of that parent folder, and so on. The minimum number of parent folders that you specify is the minimum number of ..\ sequences that the path must start with. If you allow the path to be absolute or relative or you allow drive letters or network shares then the path will not be required to start with ..\ even if you set the minimum greater than zero. The ..\ is then an alternative to the other root and drive options you allow.

Maximum Number of Parent Folders

A path that starts with ..\ is relative to the parent of the current folder. A path that starts with ..\..\ is relative to the parent of that parent folder, and so on. The maximum number of parent folders that you specify is the maximum number of ..\ sequences that the path may start with. If you set this to zero then the path cannot be relative to a parent folder at all.

Folders

Choose whether the file path can include folder names. The path will require a slash after the final folder. If you want to match a path to a folder without a trailing slash then you need to configure the pattern to match the final folder as the file name. You can match c:\folder1\folder2 as a path with a single folder (folder1) and a file name (folder2) without an extension.

List of Folders or Paths

Type in or paste in the folders or paths allowed in the file path, one per line. If you set the folders choice to “specific paths only”, type in path names like “onefolder”, “folder\subfolder” and “folder\subfolder\3rdlevel”. Only the exact paths you specify will be allowed. Otherwise, type in individual folder names like “folder1”, “folder2” and “folder3”. The regular expression will allow any combination of these folders, like folder2\folder3\folder1\folder2\.

This box is a full-featured text editor. You can cut, copy and paste with Ctrl+X, Ctrl+C and Ctrl+V as usual. Press Enter to insert a line break.

If the field validation mode is set to “none” or “loose”, the list only determines which characters are allowed. To make the regex actually check for the whole list, set the field validation mode to “average” or “strict”.

Minimum Folder Depth

The minimum number of folders that the file path should specify. Set to zero to allow file paths without a folder. Set to greater than zero to require a certain folder depth. For example C:\folder1\subfolder\level3\filename.html has a folder depth of 3.

Maximum Folder Depth

The maximum number of folders that the file path may specify. This number must be equal to or greater than the minimum number of folders. If you set both the minimum and maximum number to zero then any number of folders from zero to unlimited is allowed. Set Folders to “no folders” if you don’t want to allow any folders at all.

File names

Choose whether the file path can or should include a file name.

List of File Names or Extensions

Type in or paste in the file names the FilePath can reference, one per line. If you selected “specific extensions only”, enter the extensions, e.g. “html” and “txt”.

This box is a full-featured text editor. You can cut, copy and paste with Ctrl+X, Ctrl+C and Ctrl+V as usual. Press Enter to insert a line break.

If the field validation mode is set to “none” or “loose”, the list only determines which characters are allowed. To make the regex actually check for the whole list, set the field validation mode to “average” or “strict”.

Optional File Name

If you’ve specified that the file path should include a file name then you can choose whether the file name is optional or mandatory.

Extension

Choose whether the path’s file name can or should include an extension.

Extensions

Choose whether the file path can or should include an extension. A file path can only have an extension if it also has a file name.

Optional Extension

If you’ve specified that the file path should include an extension then you can choose whether the extension is optional or mandatory.

Examples