This statement provides various list manipulations and tests on file paths. All functions use a source path supplied in a track or named variable. These paths may be full or partial paths. The paths are always cleaned as follows:
- trailing / characters are removed.
- contiguous sequences of more than one / are replaced with a single /.
- Leading and trailing spaces are removed.
If a path was cleaned, the cleaned copy will overwrite the original source.
When using a function which saves a result, the result type must be the same as the source. ie. they must both be named variables or track variables.
When using a function which saves a result and the operation fails, the result is set to the empty string.
All functions set the action test state to true on success or false on failure. When the source is a track variable and you are executing stepwise, success defaults to success for all files. If you specify the Any option, success imples to success for any file.
All text fields may contain any of the escape sequences described in Escape Sequences.
The following functions are available:
- Copy the Filename Extension
- The filename extension is copied from the source to the supplied destination. You can elect to remove the extension from the source after the copy occurs.
- Copy the Filename
- The filename without extension is copied from the source to the supplied destination. If you want the entire filename (including extension), use the Copy the Last Path Component function.
- Copy the Last Path Component
- The last path component is copied from the source to the supplied destination. You can elect to remove the component from the source after the copy occurs.
- Set the Filename Extension
- The filename extension of the source is set to the supplied value. Note that an existing filename extension is detected by a . (the last) in a filename.
A leading . is optional.
- Set the Filename
- The filename is replaced with the supplied text. A previous filename extension, if any, is retained.
- Set the Last Path Component
- The last path component is replaced with the supplied text.
- Append a Filename Extension
- A filename extension is appended to the source. A previous filename extension, if any, is not removed.
A leading . is optional.
- Append a Path Component
- The supplied value is appended as a path component to the source.
- Remove the Filename Extension
- The filename extension, if any, is removed from the source.
- Remove the Last Path Component
- The last path component is removed from the source.
- Abbreviate Path
- If the supplied path begins with your home directory it will be replaced by ~/. eg. /Users/my user name/Yate will be replaced with ~/Yate
- Standardize Path
- Paths which begin with ~ will have the sequences replaced by the appropriate home directory. An attempt is made to remove empty path components and relative path components (. and ..). Redundant trailing / characters will be removed.
- Resolve Path
- This is the same as Standardize Path with the exception that if an item exists at the specified path and the path contains symbolic links or aliases, they will be resolved.
- Clean Path Component
- This function does not work on full paths. It works on path components. It performs the equivalent final manipulations performed on a component when renaming. All sequences of newline, control, illegal, colon (:) and slash (/) characters are replaced with a single instance of the Settings - General - Invalid Characters Substitution field. Leading and trailing spaces are removed and all sequences of multiple spaces are replaced with a single space.
- Is this an Audio File
- Returns true if the source represents an audio file that Yate can load.
- Is this an Image File
- Returns true if the source represents an image file that Yate can directly load an image from. Note that Yate attempts to scrape images from files where it cannot directly load them.
- Is this a Database File
- Returns true if the source represents a database file that Yate can open. (csv, tsv or tab filename extension).
Remember that file paths are lists with a delimiter of /. List statements can be used to manipulate paths. For example, the next to last path component in a path can be extracted as:
Set named variable 'Next to Last Component' to the item at index "-2" of the list in named variable 'Path' delimiter "/"