# Move or Copy Files

These statements are used to move or copy files to a calculated path.

Choose if you want the files relocated to a specified base path or to a base path relative to the folder containing the file being moved. Relative paths are specified by the number of levels up from the file's containing folder. Zero levels implies that the new folder structure should be in the files's containing folder. One level implies that the new folder structure should be in the parent of the file's containing folder, etc.

A specified path may contain any of the escape sequences described in Escape Sequences. At runtime the path must resolve to be:

- An absolute path starting with /
- A path relative to the user home folder starting with ~/
- A path beneath the track's containing folder, starting with ./

Warning: be careful when moving or copying files beneath the original folder while batch processing! If you are moving or copying files into a folder which has already been marked for traversal, it is possible that the files will be processed multiple times.

Choose up to three fields to be used as folders to be appended to the absolute or relative base path. When the path is constructed if you specified Album Artist and the field is empty, Artist will be used. If the value associated with a chosen field is empty an error will be issued unless a placeholder is specified. Note that if a non empty placeholder is specified and a field is not specified, the placeholder will be used. This allows the specification of a fixed value for a path component.

Transformations can be applied to each of the three fields to be optionally appended. To configure the transformations press the Transformations... button. A panel will be displayed containing the transformation settings.. Close the panel by clicking off the panel or by pressing the Escape key. For more information see Statement Transformations.

You can also elect to specify a rename template. If a template is not specified, the original filename will be appended to the destination path. If a template is specified it will be applied. If the template contains one or more Folder Start tokens, the constructed folder paths will be appended to the path. The constructed filename with the original filename extension will then be appended to the path. 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.

Be aware that while Rename templates can be used, the Move statement is attempting to move the files...not to rename them. The Rename statement's logic goes much farther to force a rename than when moving. If the execution of a Move statement effectively ends up being a rename, it is possible that the process will fail. This depends on if the volume is case insensitive (typically it is) and if the Rename template has duplication handling. The preceding explanation is also true for Copy Files which attempts to copy, not rename the files.

To summarize the destination location is calculated as follows:

- an absolute or relative base path.
- optionally up to three path components based on field contents.
- optional path components constructed by Folder Start tokens in a rename template.
- The original filename or a constructed filename from a rename template, followed by the original filename extension.

Yate, will create the final path if it doesn't exist.

With the Move statement, you can specify that you want the original folder to be deleted after the move if it is empty. Check the Delete empty folder option. Additionally if you delete the original folder you can delete an empty parent folder as well by checking the and empty parent option.

By default, the function will always be performed. You can specify to only perform the function if it is part of a compilation or not part of a compilation. This facilitates having two different back to back Move steps. One which handles the non compilation state and one which handles the compilation state.

You can specify what to do if a file already exists at the destination. You can choose to perform the default operation or to skip the move/copy or always replace the existing file. The default operation while not Batch Processing is to be presented with a dialog where you can choose what to do. The default operation while Batch Processing is to log an error message. Note that while Batch Processing, default and skip are identical.

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.

You can preview the function's application based on the files currently selected in the main window. The results are displayed in the Log Viewer.

At times, you may have to decide at runtime if you want to move or copy files. The Move statement has an Allow runtime override setting. If the setting is enabled and named variable Override Move to Copy is true (non zero integer or "true"), the Move statement will effectively become a Copy Files statement. When overridden the folder deletion settings will be ignored. Note that the Move Non Audio Files statement can also overide its functionality at runtime and uses the same named variable.