Application icon

Rename Files

This function will rename the selected files based on a chosen rename template. The rename template can be chosen from the popup list or manually entered. The only reason to manually enter the template name is if you wish to specify the name at runtime. The template field may contain any of the escape sequences described in Escape Sequences. Note that regardless of the execution mode, the template field is only evaluated once. As this is the case it may be more appropriate to indirectly specify a template in a named variable as opposed to a track variable.

The function sets the Retained Path 1 property to the new path on success. The Retained Path 2 property is set to the original path on success. On failure, both properties are emptied.

Largely for historic reasons, an error message is displayed if the rename fails. You can disable the display of error messages by setting the silent option. Note that silent is always treated as enabled when batch processing.


Runtime Previews

If a track variable is chosen for runtime preview, no renaming or modification of the Retained Path # properties takes place. The template is applied for each selected file and the resultant path is saved to the specified track variable. This is useful if for any reason you want to see the effects of a rename prior to actually renaming. In the case of an error, the track variable's contents will not begin with a / character and may contain text describing the error.

Note that IfDup sequences are not processed.

The following example shows how to do a preview and verify that the path components are identical for all files:

Rename Files (my rename template), preview to Variable 1
Test if the Variable 1 field does not start with "/" (Set test state and Variable 2)
if Variable 2 is true
    ' These files had errors
else
    Remove the last path component in Variable 1
    Test if Variable 1 is the same in every file, Set result
    if true
        ' These files have a consistent path
    else
        ' These files do not have a consistent path
    endif
endif