Path Patterns

Probably you have already used commands like dir *.txt (or ls *.txt on UN*X). This lists all files in the current directory where the name of the file ends with .txt. The *.txt is called path patterns in FMPP (elsewhere it's often called a glob).

With FMPP you also use path patterns to select certain files, say, in the modes setting, to tell FMPP which files to copy as is, and which files to execute as template. A path pattern looks like a file or directory path, but it can contain these special parts:

  • *: Matches zero or more characters, except slash (/). For example a*c matches to abc, axyzc and ac, but not a/c.
  • ?: Matches exactly one character, except slash (/). For example a?c matches to abc, but not axyzc or ac or a/c.
  • **: Matches zero or more directories of the path. For example a/**/c matches to a/b/c, a/b/xyz/c and a/c. Another example: **/*.gif matches foo.gif, a/foo.gif, and a/b/foo.gif. Also, if you use ** at the end of the pattern, then it match all file names as well. Thus, foo/** matches all files inside foo, like foo/bar.txt, or foo/sub/bar.txt. Furthermore, if the pattern ends with /, then it's considered as shorthand for /**, so foo/ is the same as foo/**.

It's important that path patterns like *.gif will only match files directly in the "current directory", but not inside its subdirectories! If you want to match all files with gif file extension (and thus in the sub-subdirectories as well), always use **/*.gif instead.

The meaning of "current directory" in FMPP depends on the concrete situation where you use the path. In most cases where you will use path patterns (as with the modes setting) it will be the source root directory.

Also, the meaning of "root directory" (a path starting with /) depends on where you use the path. That is, an absolute path like /foo.txt maybe means foo.txt in the source root directory (this is the typical case), or in the output root directory, or in the real root directory of the file system, etc.

Even if your operating system uses something else instead of / (like \ on Windows), you should always use / in path patterns. FMPP takes care of the conversion to/from the native paths format, so patterns that use / will always work. (You can use the native "slash" in path patterns as well, but it makes your project less portable.)