Files Name & Path
Files (and also Folders) in Automation Blocks are just texts representing the full path of the file. The following blocks will help you to manipulate these paths, which is very helpful for creating new filenames, renaming files, etc.
The blocks have been created to manipulate file paths, but of course they work on any text - so you can also use them to manipulate other texts, too.
Replace In File Path
A file path like
path/to/myFile001.png consists of different sections:
- the folder
- the name
- the numbers
- the extension
With this block, you can replace any of these parts with something new.
When you replace the suffix and your new suffix does not have a dot at the beginning, the block will add one automatically. So, it doesn't matter if you use
.jpg as the new suffix, for example. In the same way, if you replace the path, it does not matter if your path ends with a
\) or not, since the block will add one if needed.
Tinker File Path
This block is your Swiss army knife when it comes to manipulating a file path. It's like an advanced version of the Replace in File Path block. It decomposes a file path into its ingredients - like splitting
.jpg. You can then recombine those parts however you like.
The block extracts the following parts from the path:
- $FOLDER the folder where the file is located.
- $NAME the name of the file without numbers at the end (if the file is part of an image sequence, for example) and without the extension
- $NUMBERS the numbers at the end of the filename (for an image sequence, for example). If the filename has no numbers at the end, this is empty.
- $EXT The file extension, i.e. the suffix like
.movincluding the dot.
- $SEP the separator symbol used in the path - either
The block allows you to combine these parts again in whatever way you want by specifying a pattern.
The example above turns the file name
path/to/my/file012.jpg into the result
path/to/my/file_now_png_00012.png, for example.
number of digits in $NUMBERS
You can change the number of digits in
$NUMBERS by adding the number of desired digits in square brackets.
0123, for example, then
00123, resulting in 5 digits. This function only adds or removes zeros, but no other digits, so
$NUMBERS will give
123 and not
$FOLDER you can go up the parenting chain by adding the number of levels you want to go up in square brackets.
The following block constructs a new path from the project file path pointing to a folder
footage, which is a sibling of the folder where the project is created.
So if the project is
C:\my\project\pr\myproject.prproj, for example, then the result is
The Text Pattern block is very useful for creating file paths, but also for all kinds of other strings. For this reason, it's documented in the Text category.