Rename, Move, and Copy Files: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
 
(61 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{incomplete}}

{{Warning|This tool moves files on disk, and can change a lot of data with a single action, so go slowly and '''try a few files before you do very many'''.
{{Warning|This tool moves files on disk, and can change a lot of data with a single action, so go slowly and '''try a few files before you do very many'''.
Having a recent [[Library Backup]] on hand is strongly recommended.}}
Having a recent [[Library Backup]] on hand is strongly recommended.}}
Line 6: Line 4:
[[File:Rename Move Copy-Audio-Example.png|thumb|right|480px|Media Center's Rename, Move, & Copy Files dialog, ready to organize some files on disk.]]
[[File:Rename Move Copy-Audio-Example.png|thumb|right|480px|Media Center's Rename, Move, & Copy Files dialog, ready to organize some files on disk.]]


This is a powerful [[Library Tool]] that can be used to move, rename, and create copies of your files using their [[Library Fields]] (metadata tags) to create a file structure on disk. This is also a great way to get your media organized into a central location on your hard disk. However, use this feature with care, because it can move files on the hard disk.
This is a powerful [[Library Tool]] that can be used to move, rename, and create copies of your files using their [[Library Fields]] (metadata tags) to create a file structure on disk. This is also a great way to get your media organized into a central location on your hard disk.


Media Center generally does not care where the files you [[import]] into your [[Library]] live on disk. It can use files from any volume that can be seen by your operating system (including UNC paths and network drives on Windows, and mounted shares on Mac OSX). Unlike iTunes, MC does not automatically create duplicates and move your files around on disk when files are imported, but it uses them exactly where it found them. This is good because it can be used alongside other applications (like iTunes, if you desire).
Media Center generally does not care where the files you [[import]] into your [[Library]] live on disk. It can use files from any volume that can be seen by your operating system (including UNC paths and network drives on Windows, and mounted shares on Mac OSX). Unlike iTunes, MC does not automatically create duplicates and move your files around on disk when files are imported, but it uses them exactly where it found them. This is good because it can be used alongside other applications (like iTunes, if you desire).
Line 12: Line 10:
However, if you want to organize your files and consolidate them into directories on disk, the Rename, Move, and Copy Files tool provides a powerful and flexible way to get yourself organized. It can also be used to create copies of your media files and for a handful of other filesystem management tasks.
However, if you want to organize your files and consolidate them into directories on disk, the Rename, Move, and Copy Files tool provides a powerful and flexible way to get yourself organized. It can also be used to create copies of your media files and for a handful of other filesystem management tasks.


To access this tool, select some files you'd like to move or copy elsewhere, and do one of:
To access this tool, ''select the files'' you'd like to move or copy elsewhere, and do one of:
* <span style="color:#8B4513">Right-click > Library Tools > Rename, Move, & Copy Files</span>
* <span style="color:#8B4513">Right-click > Library Tools > Rename, Move, & Copy Files</span>
* <span style="color:#8B4513">Tools > Library Tools > Rename, Move, & Copy Files</span>
* <span style="color:#8B4513">Tools > Library Tools > Rename, Move, & Copy Files</span>
Line 29: Line 27:
* '''Do a few files first''': Before you select every file in your Library and apply a new file naming template, select just a handful of files to test it with. Make sure to investigate where the files end up and make sure you got everything right before you apply changes to large sets of files.
* '''Do a few files first''': Before you select every file in your Library and apply a new file naming template, select just a handful of files to test it with. Make sure to investigate where the files end up and make sure you got everything right before you apply changes to large sets of files.


* '''Use the Preview Panel''': The tool provides a preview of changes. Review this before applying your changes to make sure you didn't make any mistakes, or select the wrong files.
* '''Use the [[Rename,_Move,_and_Copy_Files#Preview_Panel|Preview Panel]]''': The tool provides a preview of changes. Review this before applying your changes to make sure you didn't make any mistakes, or select the wrong files.


* '''Understand filesystem basics''': Using this tool effectively requires a basic understanding of how your system stores files on disk, and about [http://en.wikipedia.org/wiki/Path_%28computing%29 filesystem paths]. You don't need to be an expert, but you will need to understand basics about how files are named, where they are stored on disk, and how your operating system structures the filenames used.
* '''Understand filesystem basics''': Using this tool effectively requires a basic understanding of how your system stores files on disk, and about [http://en.wikipedia.org/wiki/Path_%28computing%29 filesystem paths]. You don't need to be an expert, but you will need to understand basics about how files are named, where they are stored on disk, and how your operating system structures the filenames used.
Line 40: Line 38:
; Copy : Creates new independent copies of the selected files. This mode '''does not''' alter the Library or the source files on disk.
; Copy : Creates new independent copies of the selected files. This mode '''does not''' alter the Library or the source files on disk.
; Copy and update database to point to new location : Creates new independent copies of the selected files, and ''replaces'' the Library entries for the existing source files with the new files. This is identical to Rename mode, except that it leaves the original copies behind untouched.
; Copy and update database to point to new location : Creates new independent copies of the selected files, and ''replaces'' the Library entries for the existing source files with the new files. This is identical to Rename mode, except that it leaves the original copies behind untouched.
; Update database to point to new location (no file rename, move, or copy) : Only changes the [Filename] path for the selected files in the Media Center Library. This mode '''does not''' move or copy any files on disk.
; Update database to point to new location (no file rename, move, or copy) : Only changes the [Filename] path for the selected files in the Media Center Library. This mode '''does not''' move or copy any files on disk. This can be useful (especially combined with the [[Find & Replace Template]] discussed below) if you moved your media files on disk outside of Media Center, and now you need to reconnect the Library entries to the files in their new locations.

=== Using With Media Network Libraries ===

The Rename, Move, and Copy Files tool ''cannot'' be used from a client of a Library being served by another copy of Media Center running as a [[Media Server]]. To use it, you must run it on the server machine directly.

=== Files That Will Be Processed ===
[[File:RMCF-Move All Files Option.png|thumb|right|380px|Enable this if you want Media Center to move or copy sidecar files it didn't create.]]

By default, Media Center will ''only'' process the following files:
* The specific files ''selected'' when you open the Rename, Move, and Copy Files tool (those shown in the Preview Panel)
* Any sidecar files Media Center created itself (cover art and JRSidecar.xml files) which have not been [[imported]] into MC's [[Library]].

Any other auxiliary files not explicitly selected in the tool will be left untouched in their original locations. This includes sidecar files which may be "related to" the source media files, such as auxiliary artwork or subtitle files.

If you want MC to also move or copy these sidecar files, enable:

; Move all files in folder (including non-imported files)
: If enabled, all '''non-imported''' files found alongside the selected media files will be moved to the destination directory along with the source files. Note that if the files have been imported, they will still not be moved (otherwise the database entries for these files would break) and you must select them explicitly in Media Center to have the tool process them.

:''Please Note'': '''Exercise caution''' using this option with any JTV formatted Television recording files. JTV files are compound-type files, which reference separate data files that must remain together.

== Preview Panel ==
[[File:RMCF-Preview Panel.png|thumb|right|420px|The Preview Panel shows exactly what the tool will do, before it has been applied.]]

The Rename, Move, and Copy Files tool provides a Preview Panel which details the ''Original'' and ''New'' filenames that will be output when the tool is run. This tool will list every selected file to be processed, the mode, and the exact output filename that will be created. The Preview Panel's columns are resizable, as is the entire Rename, Move, and Copy Files dialog, if you need to see more of the filenames. The ''New'' column of the Preview Panel updates on the fly as you make changes to the Templates, so that you can see exactly how changes you make there impact the output of the tool, before applying any changes.

If no change will be made to the output filename, the New listing for the file will be <tt><no change></tt>. If you try to [[Rename,_Move,_and_Copy_Files#Using_With_Media_Network_Libraries|use the tool on a Media Network Library]] in an unsupported Mode, then the New value will list <tt><invalid change></tt>.

Please check through the Preview Panel carefully before applying any changes, especially if you have created a new set of Templates for the first time.


== Templates ==
== Templates ==
Line 70: Line 97:


=== Find & Replace ===
=== Find & Replace ===
[[File:RMCF-Find Replace-Inset Copy Example.png|thumb|right|320px|The Find & Replace Template set to copy files to the Desktop.]]

The [[Find & Replace Template]] is used to alter the existing file path by searching for text in the original filename, and replacing it with new text. It is often most useful when moving large sets of files from one disk or storage location to another. Unlike the Filename and Directories Templates, the Find & Replace Template is used to transform the existing filename.

For example, you might want to:
* move all of the files from Drive E to Drive M, or
* move all of the files from <tt>/Users/<USERNAME>/Music</tt> over to <tt>/Users/Shared/Media/Audio/Music</tt>
* copy a set of files from a network drive to a local disk, while preserving the original filename and directory structure


For a full description of configuring this template, see:
For a full description of configuring this template, see:
* [[Find and Replace Template]]
* [[Find and Replace Template]]


=== Special Characters and Slashes ===
== Availability ==
[[File:RMCF-Replace_Slashes.png|frame|right]]


Any special characters output by a field or expression included in a Template will be converted to underscores (_) to ensure that the filename produced is valid in the filesystem. Media Center [http://yabb.jriver.com/interact/index.php?topic=70363.msg475457#msg475457 may also truncate values] if the maximum length of the filename produced exceeds allowable OS limits.
The Rename, Move, and Copy Files tool is available on all versions of Media Center (including OSX and Linux). In older versions of Media Center, it was called Rename Files from Properties, and while all features are not identical, older versions functioned in largely the same manner.

Also, any fields that contain slash characters used to delineate directory names will be converted to underscores automatically (backslashes on Windows, and forward slashes on other OSes). Otherwise, if the Artist field contained "AC\DC" and you used this field in your Directories Template, you'd end up with a folder called "AC" which contains a folder called "DC".

If you are intentionally using a calculated field to create directory structures in your Directories Template, you can uncheck the ''Replace slashes in expressions'' option to pass through any slashes found in an expression or field as-is.

=== Empty Fields ===
[[File:RMCF-Unknown Disc Example.png|thumb|right|320px|Empty fields output as "Unknown".]]

Any field used in a Template which contains no value for a particular file is output as:
: <tt>Unknown <Field Name></tt>

For example, if you include [Disc #] in your Directories Template, and select files which do not contain a value in that field, the output will be <tt>Unknown Disc #</tt> as is shown in the screenshot on the right.

If you'd prefer this value to be omitted entirely when the output from the field is empty, you can use a simple expression instead of the Field itself to handle these fields specially. Instead of inserting the [Disc #] field directly, you can use:
:<code>If(IsEmpty([Disc #],1),,[Disc #])</code>

And then this will output as nothing at all, and that part of the filename or directory structure will be omitted. For more information, refer to this thread on Interact:
* [http://yabb.jriver.com/interact/index.php?topic=92425.0 Rename, Move & Copy Files uses "unknown" for blank fields]

== Presets ==
[[File:RMCF-Preset Menu.png|thumb|right|240px|Use the Preset menu to quickly save and recall settings.]]

The ''Preset'' button allows you to save and recall ''all'' of the settings in the Rename, Move, and Copy Files dialog so that you can easily re-use settings again and again. Presets include the Mode, Templates, and all options within the dialog.

Any time you design a set of Templates that you might need to apply to files in the future, save it as a Preset and then when you need it, you can access those exact settings quickly under the Preset button. To update an existing Preset, simply save it again and use the same name.

You can also use the Preset menu's ''Copy Settings to Clipboard'' and ''Paste Settings from Clipboard'' choices to share presets with other users on [http://yabb.jriver.com/interact/index.php Interact]. For example, to use this preset designed for TV Show episodes, copy the entire code block below and then use the Paste Settings item under the Preset menu to import the settings.

<pre style="white-space:pre-wrap; width:420px; border:1px solid lightgrey; background:#F8F8F8">
<XMLPH version="1.0">
<Item Name="UseDirectoryRule">1</Item>
<Item Name="Name">TV Shows</Item>
<Item Name="Replace Slash">1</Item>
<Item Name="FilenameRule">If(IsEmpty([Season], 1),,s[Season])If(IsEmpty([Episode],1),e00,e[Episode]) - [Name]</Item>
<Item Name="BasePath">M:\</Item>
<Item Name="UseFilenameRule">1</Item>
<Item Name="Find"/>
<Item Name="Mode">0</Item>
<Item Name="UseFindReplace">0</Item>
<Item Name="Move All">0</Item>
<Item Name="DirectorySmartMultiArtistHandling">0</Item>
<Item Name="Replace"/>
<Item Name="DirectoryRule">[Media Type]\[Media Sub Type]\[Series]\[Season]\</Item>
</XMLPH>
</pre>

== Availability ==


:''Please Note'': The Rename, Move, and Copy Files tool ''cannot'' be used to move files from a copy of MC running as a client to another [[Library Server]]. To use it for renaming or moving files, you must run it on the server machine directly.
The Rename, Move, and Copy Files tool is available on all versions of Media Center (including OSX and Linux). In older versions of Media Center, it was called ''Rename Files from Properties'', and while all features are not identical, older versions functioned in largely the same manner.


== More ==
== More ==

Latest revision as of 19:52, 2 September 2019

Media Center's Rename, Move, & Copy Files dialog, ready to organize some files on disk.

This is a powerful Library Tool that can be used to move, rename, and create copies of your files using their Library Fields (metadata tags) to create a file structure on disk. This is also a great way to get your media organized into a central location on your hard disk.

Media Center generally does not care where the files you import into your Library live on disk. It can use files from any volume that can be seen by your operating system (including UNC paths and network drives on Windows, and mounted shares on Mac OSX). Unlike iTunes, MC does not automatically create duplicates and move your files around on disk when files are imported, but it uses them exactly where it found them. This is good because it can be used alongside other applications (like iTunes, if you desire).

However, if you want to organize your files and consolidate them into directories on disk, the Rename, Move, and Copy Files tool provides a powerful and flexible way to get yourself organized. It can also be used to create copies of your media files and for a handful of other filesystem management tasks.

To access this tool, select the files you'd like to move or copy elsewhere, and do one of:

  • Right-click > Library Tools > Rename, Move, & Copy Files
  • Tools > Library Tools > Rename, Move, & Copy Files
  • Press F6

This will open the Rename, Move, and Copy Files dialog shown at right. Set the dialog's options and check through the preview panel to make sure your changes look correct, and then click OK to apply the changes or make the copies.

Cautions

Before running the Rename, Move, and Copy Files tool, you should always consider several cautions:

  • Make a Library Backup: As mentioned above, creating a Library Backup before running the tool is strongly recommended. It can alter your files on disk and your Library in Media Center.
  • Disable Auto-Import Background Scanning: You may also want to temporarily disable Auto-Import Background Scanning. Otherwise, if you apply changes to any Watched Directories, the Auto-Import system may pick up changes while the tool is still running and moving files, which can leave your Library in an inconsistent state.
  • Do a few files first: Before you select every file in your Library and apply a new file naming template, select just a handful of files to test it with. Make sure to investigate where the files end up and make sure you got everything right before you apply changes to large sets of files.
  • Use the Preview Panel: The tool provides a preview of changes. Review this before applying your changes to make sure you didn't make any mistakes, or select the wrong files.
  • Understand filesystem basics: Using this tool effectively requires a basic understanding of how your system stores files on disk, and about filesystem paths. You don't need to be an expert, but you will need to understand basics about how files are named, where they are stored on disk, and how your operating system structures the filenames used.

Modes

Rename Move Copy-Modes.png

The Rename, Move, and Copy Files tool can be used in one of four primary modes:

Rename (moves files if directory changes)
Renames and moves files, including from one disk to another.
Copy
Creates new independent copies of the selected files. This mode does not alter the Library or the source files on disk.
Copy and update database to point to new location
Creates new independent copies of the selected files, and replaces the Library entries for the existing source files with the new files. This is identical to Rename mode, except that it leaves the original copies behind untouched.
Update database to point to new location (no file rename, move, or copy)
Only changes the [Filename] path for the selected files in the Media Center Library. This mode does not move or copy any files on disk. This can be useful (especially combined with the Find & Replace Template discussed below) if you moved your media files on disk outside of Media Center, and now you need to reconnect the Library entries to the files in their new locations.

Using With Media Network Libraries

The Rename, Move, and Copy Files tool cannot be used from a client of a Library being served by another copy of Media Center running as a Media Server. To use it, you must run it on the server machine directly.

Files That Will Be Processed

Enable this if you want Media Center to move or copy sidecar files it didn't create.

By default, Media Center will only process the following files:

  • The specific files selected when you open the Rename, Move, and Copy Files tool (those shown in the Preview Panel)
  • Any sidecar files Media Center created itself (cover art and JRSidecar.xml files) which have not been imported into MC's Library.

Any other auxiliary files not explicitly selected in the tool will be left untouched in their original locations. This includes sidecar files which may be "related to" the source media files, such as auxiliary artwork or subtitle files.

If you want MC to also move or copy these sidecar files, enable:

Move all files in folder (including non-imported files)
If enabled, all non-imported files found alongside the selected media files will be moved to the destination directory along with the source files. Note that if the files have been imported, they will still not be moved (otherwise the database entries for these files would break) and you must select them explicitly in Media Center to have the tool process them.
Please Note: Exercise caution using this option with any JTV formatted Television recording files. JTV files are compound-type files, which reference separate data files that must remain together.

Preview Panel

The Preview Panel shows exactly what the tool will do, before it has been applied.

The Rename, Move, and Copy Files tool provides a Preview Panel which details the Original and New filenames that will be output when the tool is run. This tool will list every selected file to be processed, the mode, and the exact output filename that will be created. The Preview Panel's columns are resizable, as is the entire Rename, Move, and Copy Files dialog, if you need to see more of the filenames. The New column of the Preview Panel updates on the fly as you make changes to the Templates, so that you can see exactly how changes you make there impact the output of the tool, before applying any changes.

If no change will be made to the output filename, the New listing for the file will be <no change>. If you try to use the tool on a Media Network Library in an unsupported Mode, then the New value will list <invalid change>.

Please check through the Preview Panel carefully before applying any changes, especially if you have created a new set of Templates for the first time.

Templates

The Rename, Move, and Copy Files tool reorganizes your files on disk using one or more of a set of templates that determine the final filename and directory path used. These are:

  • Directories: the base disk and directories used to store the files
  • Filename: the names given to the individual files
  • Find & Replace: alter the original paths by finding and replacing text strings in the source filenames and paths.

Directories

The Directories Template with a basic setup for music files on Mac OSX.

The Directories Template is used to set the base path and directories used to store your files. You set a Base Path that will be used for all files selected in the tool (this would typically contain the disk letter or volume name), and then a Rule which auto-generates the directories used based on each file's metadata. The Directories Template does not consider the source directories, disk, or volume, and the selected files can come from a variety of source locations.

For example, you might want to consolidate files from a variety of source locations on disk into a common media folder, and then put each file in folders corresponding to their [Artist] property, with sub-folders for each [Album].

For a full description of configuring this template, see:

Filename

The Filename Template with a basic setup for music files.

The Filename Template is used to set the naming of the files selected in the tool. Like the Directories Template, it consists of a Rule which auto-generates the filename base on each file's metadata. The Filename Template does not consider the source filenames at all, and the replacement name is built from scratch using the Rule.

For example, you might want to name your music files with their [Disc #], [Track #], and [Name], and your movies with their [Name] and [Year].

For a full description of configuring this template, see:

Find & Replace

The Find & Replace Template set to copy files to the Desktop.

The Find & Replace Template is used to alter the existing file path by searching for text in the original filename, and replacing it with new text. It is often most useful when moving large sets of files from one disk or storage location to another. Unlike the Filename and Directories Templates, the Find & Replace Template is used to transform the existing filename.

For example, you might want to:

  • move all of the files from Drive E to Drive M, or
  • move all of the files from /Users/<USERNAME>/Music over to /Users/Shared/Media/Audio/Music
  • copy a set of files from a network drive to a local disk, while preserving the original filename and directory structure

For a full description of configuring this template, see:

Special Characters and Slashes

RMCF-Replace Slashes.png

Any special characters output by a field or expression included in a Template will be converted to underscores (_) to ensure that the filename produced is valid in the filesystem. Media Center may also truncate values if the maximum length of the filename produced exceeds allowable OS limits.

Also, any fields that contain slash characters used to delineate directory names will be converted to underscores automatically (backslashes on Windows, and forward slashes on other OSes). Otherwise, if the Artist field contained "AC\DC" and you used this field in your Directories Template, you'd end up with a folder called "AC" which contains a folder called "DC".

If you are intentionally using a calculated field to create directory structures in your Directories Template, you can uncheck the Replace slashes in expressions option to pass through any slashes found in an expression or field as-is.

Empty Fields

Empty fields output as "Unknown".

Any field used in a Template which contains no value for a particular file is output as:

Unknown <Field Name>

For example, if you include [Disc #] in your Directories Template, and select files which do not contain a value in that field, the output will be Unknown Disc # as is shown in the screenshot on the right.

If you'd prefer this value to be omitted entirely when the output from the field is empty, you can use a simple expression instead of the Field itself to handle these fields specially. Instead of inserting the [Disc #] field directly, you can use:

If(IsEmpty([Disc #],1),,[Disc #])

And then this will output as nothing at all, and that part of the filename or directory structure will be omitted. For more information, refer to this thread on Interact:

Presets

Use the Preset menu to quickly save and recall settings.

The Preset button allows you to save and recall all of the settings in the Rename, Move, and Copy Files dialog so that you can easily re-use settings again and again. Presets include the Mode, Templates, and all options within the dialog.

Any time you design a set of Templates that you might need to apply to files in the future, save it as a Preset and then when you need it, you can access those exact settings quickly under the Preset button. To update an existing Preset, simply save it again and use the same name.

You can also use the Preset menu's Copy Settings to Clipboard and Paste Settings from Clipboard choices to share presets with other users on Interact. For example, to use this preset designed for TV Show episodes, copy the entire code block below and then use the Paste Settings item under the Preset menu to import the settings.

<XMLPH version="1.0">
<Item Name="UseDirectoryRule">1</Item>
<Item Name="Name">TV Shows</Item>
<Item Name="Replace Slash">1</Item>
<Item Name="FilenameRule">If(IsEmpty([Season], 1),,s[Season])If(IsEmpty([Episode],1),e00,e[Episode]) - [Name]</Item>
<Item Name="BasePath">M:\</Item>
<Item Name="UseFilenameRule">1</Item>
<Item Name="Find"/>
<Item Name="Mode">0</Item>
<Item Name="UseFindReplace">0</Item>
<Item Name="Move All">0</Item>
<Item Name="DirectorySmartMultiArtistHandling">0</Item>
<Item Name="Replace"/>
<Item Name="DirectoryRule">[Media Type]\[Media Sub Type]\[Series]\[Season]\</Item>
</XMLPH>

Availability

The Rename, Move, and Copy Files tool is available on all versions of Media Center (including OSX and Linux). In older versions of Media Center, it was called Rename Files from Properties, and while all features are not identical, older versions functioned in largely the same manner.

More