# Copy Metadata Between Files

This action copies metadata from a file at an index to either a file at a different index or all current files. Prior to Yate v6.2 the indexes were always treated as File Index properties as returned by the Get Property statement or via an escape sequence. The issue with the File Index property is that it may change depending on execution of a file availability statement. Further various Run statements can inherently change the list of available files as can the Load & Run statement. v6.2 saw the implementation of the Loaded File UID property which is constant regardless of the current list of available files. You can use either property as the source of the indexes but the Loaded File UID property does allow for some increased functionality.

This statement copies specified metadata from a single file at a specified index to either a single file or all other currently available files. The currently available files is either the initial file selection or the set established by a file availability statement or imposed by one of the Run statement variants.

You can copy the source files current metadata or optionally the source file's initial metadata. The initial metadata is the data first loaded or last saved to a file. When copying initial metadata the destination can be the same file as the source. This means that the source file can potentially be modified.

The indexes are evaluated at runtime and may contain any of the escape sequences described in Escape Sequences.

If any of the file indexes are invalid the function will be ignored. For example, you did not specify copy initial values and the source and destination are the same.

You can copy all fields or a list of chosen fields. Unhandled fields are never copied.

Note that when copying a metadata field which supports multiple items, all items will be copied. This incudes Artwork, Comments, Lyrics, Ratings, User Defined Text Info, User Defined URLs, and more. You can find a complete list here.

When copying User Defined Text Info items you can supply a list of exclusions in named variable Transfer UDTI Exclusions. The named variable contains a list of UDTIs delimited by commas (,), newline characters (\n) and the default list delimiter (\~). Items in the exclusion list are not copied and are not removed. As an example this could be used to copy all UDTIs except the Apple App PIDs.

The action test state will be set to true if any metadata was copied, (not necessarily modified). If nothing was copied, the action test state will be set to false.

The statement is executed once regardless as to whether it is run stepwise or grouped.

# When Using the File Index Property

The indexes refer to tracks in the current set of available files. Note that running grouped has no effect on the File Index property.

# When Using the Loaded File UID Property - Copy to One File

The indexes can be in the current file selection or the initial set of files when the action was first started. This means that file availability statements can only expand the scope of this statement. They cannot limit it.

# When Using the Loaded File UID Property - Copy to All Files

The source index can be in the current file selection or the initial set of files when the action was first started. Only the currently available files can potentially be modified. If you are copying initial values and you do not want to modify the source file, use a file availability statement to remove it from the currently available files.

Field Selection Modes in Tables