Update Location of Files in Database
Version 2.3.1
- MediaMonkey Add-on -

by Zvezdan Dimitrijević

This is information about the enhanced version of Update Location of Files add-on for MediaMonkey v2.x-4.0. The freely available version of this add-on is already very useful after upgrading hard disks or moving files from/to some network drive with UNC path. However, the enhanced version is even more powerful and it has added many very useful options; among others it allows update of several locations at once and removing of duplicates that could appear as a result of the applied update.


What is new

v2.3.1 - 2020-07-27

v2.3 - 2019-05-11

v2.2.3 - 2019-03-04

v2.2.2 - 2017-08-02

v2.2.1 - 2017-03-01

v2.2 - 2017-02-01

v2.1 - 2017-01-14

v2.0 - 2016-11-28

Installation


UpdateLocationOfFiles-2.3

Usage

Using this add-on is very similar to the older version of the add-on. After its installation you will find the new "Update Location of Files in Database..." option in the Tools | Scripts menu. When you choose that option from the menu, you will get opened the add-on's dialog box. After its first start, you will get selected the first drive from the database that is missing and other options will be set to their default blank/unchecked states; if you change some option in the dialog box and start the update, the settings will be remembered in the MediaMonkey.ini file, so the next opening of the dialog box will show those last settings.

With the Old drive and Old path combo boxes you should set the old location of files (source) and with the New path text box you should set the new location of files (destination). To be able to do update, both locations should be correctly specified. If your Old/drive path dropdown lists are not filled with drives/paths, that means that your database is empty, in which case this add-on cannot be used - you should have database that contains files if you want to update their location (as the name of the add-on suggests).

The Old drive combo box shows all drives containing media files that are added to the database (Library). When you choose some drive from that combo box, the Old path combo box will be filled with all folders from that drive containing files in the database including all their parent folders until the root of drive. For example, if I have one track in the database which has the path C:\Music\Pink Floyd\Time.mp3, there would be listed 3 items: C:\, C:\Music\ and C:\Music\Pink Floyd\.

With the Old path combo box you are choosing the base folder that you want to update. This means that you will get updated all files from that folder and its sub(-sub)-folders recursively. This also means that you should select the root of the drive in the Old path combo box if you want to update all files from that drive. For example, if I specify C:\Music\, all files which have that on the begin of the path would be updated, like C:\Music\Pink Floyd\Time.mp3, but not file like C:\My Documents\Pink Floyd\Time.mp3 since it has different base folder.

The Old location label shows how many media and playlist files from the database are located in the base folder (and its sub-folders) selected by Old path; also, it shows how many of those files still physically exist at that location.

For example, if my Old location shows "228831 media files + 1329 playlist files, 229920 existing + 240 missing", that means that I have 228831 records about media files and 1329 records containing the information about playlist files stored into the database. The sum of these two numbers is 230160 files and it is equal to the sum of another two numbers (229920 existing + 240 missing). In another words, of all my media and playlist files referenced in the database I have 240 files that are psychically missing on the location that I have specified with the Old path. It is not displayed how many media or playlist files are existing/missing individually, but only for their sum.

By the way, the records containing information about playlist files are not the same as the records about playlists. The records of playlists could contain the information about the imported playlists files, but if you have playlists that are created by yourself, i.e. they are not created by import from playlist files, then such playlists will not contain the information about playlist files.

In the New path text box you should specify the base folder which would replace the old one after applied the Update option. For example, if the Old path is "c:\Music\" and New path is "d:\Media\My Music\" then all files in the database that have "c:\Music\" on the begin of path will be updated to "d:\Media\My Music\". You could type the new path on keyboard or you could click on the "..." button to choose some existing drive/folder.

Similarly to the Old location, the New location label shows how many media and playlist files from the database physically exist at the base folder (and its sub-folders) specified by New path.

When you change old or new path, the add-on will start checking for existence of the files at specified locations which could be time consuming, especially with the large databases and/or media files located on network drives. You don't need to wait for the add-on to finish searching for files since it is executed in another thread just for checking purpose and will be canceled if you click on the Update button. However, it is recommended to wait for add-on to finish with that searching because it would display how many files from the database are found on the new specified location.

If you have the database containing files stored on several drives/paths, and if you want to update many of their locations at once, you could specify them all in the Old path combo box using " (double quote) or | (vertical line) as separators. The difference between those two separators is that the " separator is (mainly) used for the one-to-one replacements and the | separator is used for the many-to-one replacements. Similarly, the New path combo box could contain multiple paths separated with the " separator, but it doesn't support | as a separator.

For example, if I have c:\|d:\|e:\ in the Old path and f:\ in the New path, all files located on the c:, d: and e: drives will be updated to f:. However, if I have the Old path as c:\"d:\"e: and the New path as f:\"g:\"h:\ then files from c: will be updated to f:, files from d: will be updated to g: and files from e: will be updated to h:.

The number of specified " separators in the Old path combo box is recommended to be equal to the number of the " separators in the New path, but that is not necessary. In case that the number of the " separators in the Old path is greater than the number of the same separators in the New path, the rightmost paths from the Old path that don't have the corresponding pair in the New path will be replaced with the last (rightmost) path specified in the New path.

For example, if the Old path is c:\"d:\"e:\ and the New path is f:\"g:\ then c: will be updated to f: and both d: and e: will be updated to g:. The same result could be get if the Old path is c:\"d:\|e:\. However, if the Old path is c:\|d:\"e:\ then files from both c: and d: will be updated to f: and files from e: will be updated to g:. Here is one more example of using different separators in the Old path: c:\|d:\"e:\|f:\ and with the New path set to g:\"h:\ the files from both c: and d: will be updated to g: and files from both e: and f: will be updated to h:.

Instead of typing paths by hand on keyboard, you could select paths using the Old path dropdown list and the "..." button next to the New path text box with a mouse. When you choose some drive from the Old drive combo box or some path from the Old path dropdown list, the selected item from that list will replace the whole content of the Old path input field, unless its content is not finished with the " or | characters in which case the selected path will be appended to the end of Old path. Similarly, when you choose some path using the "..." button, it will replace the whole content of the New path text box, unless its content is not finished with the " character in which case the selected path will be appended to the end of the New path.

The " and | buttons on the right side of the Old path and New path fields allow you to append the corresponding separators to the end of input field using mouse.

If the option Copy files - from the old to the new location first is turned on, then the files will be physically copied before updating of the database; otherwise, only the data about the location of files in the database will be modified.

Similarly, if you turn on the Move files - from the old to the new location first option, the files will be physically moved before updating of the database. If you plan to use Copy or Move option, it is recommended that you temporarily turn off the File Monitor option in the Options dialog box (if you have it already enabled) before you open the add-on's dialog box.

If you have files with the same filenames in the old and new locations, you could determine what will happen when you choose Copy or Move option using the Overwrite files with the same names at new location option. If that option is turned off, the files with the same names at the new location will be kept, as well as the files at the old location (even when the Move option is selected). However, if the Overwrite option is turned on, the files from the old location will overwrite files with the same names at the new location.

When the Only older Date modified option is turned on, the files with the same names at the new locations will be overwritten only if they have older Date Modified attributes, i.e. the files at the old location are modified sooner.

If you have the Copy/Move all files beside of media files (e.g. .jpg, .html) option turned off, only the media/playlist files whose records are previously stored in the database could be copied/moved. However, if you have some extra files beside of the media files in their containing folders, e.g. bitmaps with covers or some lyrics/txt/html files, they could be copied/moved together with the media files if you turn the mentioned option on. That means that all (sub-)folders will be copied/moved from the old to the new location recursively.

The Delete emptied folders is similar to the option of the same name in the Auto-Organize Files dialog box. If you turn that option on, the folders that are left empty after successfully applied movement of media files will be deleted.

If you want to update location in database only for files that exist at the new specified location, you should turn on the option Update paths in database only for files that exist at new location. In that case you should wait for the add-on to finish with search for files before you click on the Update button. However, if you turn that option off, you could click on the Update button immediately after you specify the old and new paths.

You should turn on the Remove %d duplicates of updated files from database and merge their playing data option if you want to remove records from the Songs table in the database about files that will become duplicates after applied the Update option. This option cannot be applied on files that are on UPnP or have URL paths. The add-on treats files as duplicates only if they have exactly the same paths, but it doesn't compare their tags at all. The number displayed in this check box shows the number of files that could be removed on update; it is less than the number of files displayed in the main filelist when you choose Keep/Select duplicates option because the oldest added duplicates will not be removed on update, but will get the merged data (or the newest added, depending on the next option).

Let say that I have a database with two files: c:\Music\A.mp3 with PlayCounter = 5 and d:\Test\A.mp3 with PlayCounter = 2, and let say that I want to update c:\Music\ to d:\Test\. If I have the mentioned option turned off, after the update I will still have the same two files in the database with the unchanged PlayCounter values, but this time (after the update) they both will have the same paths - d:\Test\A.mp3. However, if I turn that option on, after the update I will get removed one file from the database and the file which is first added to the database will be kept and will get merged its playing data with the data of the removed file (in this example the remaining file will have 7 play counts). The LastTimePlayed field in the Songs table will be also modified appropriately (set to the newer date), as well as all play data in the Played table.

If the option Remove duplicates is turned on, you could choose which duplicates you want to keep when you apply the update with the option Keep duplicates that have: oldest / newest Date added. That option can be useful e.g. if you have two drives in the database with the (almost) same content, but the newer added drive has updated tags in files.

The leftmost button on the bottom of the dialog box allows showing/selecting of the media files that are missing at the new location or the duplicates of updated files in the main filelist of the program, with the particular action that could be chosen from the following dropdown list (Keep missing files, Keep duplicates, ...). The next combo box determines which chosen files will be showed/selected - only those from the current filelist or those from the entire Library.

The Backup button allows you to save a copy of the current (active) database to some safe place. And finally, when all previously mentioned options are set as wanted, the click on the Update button will start the update action (which could take some time). After the update is finished, the add-on could try to refresh the affected paths in the main filelist, but sometimes that could be unsuccessful because of some limitations in the program itself, in which case the simple restart of the program would help. The paths in the Now Playing panel will be updated as well if the affected files were previously already stored in the database.

Important

This add-on is mostly useful if you have similar folder structure on the old and new drives, i.e. when the old and new paths have different only base folders. If you have moved media files to the new hard disk using different filenames and/or folder structure than it is stored in the database, then you could try Restore/Synchronize Database add-on instead since it can transfer data even in such situations, but it is much slower.

This add-on is relatively dangerous and could cause some corrupted data in the current database, especially if you forcibly terminate the program during its execution! Please make a backup of the current database before you apply this add-on. If you want to use the Copy/Move files option of this add-on, it is recommended that you already have a backup of your media files as well.

Disclaimer

This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.

Notice

This add-on is a false positive reported as a worm by F-Secure. The author of F-Secure promised me that will update its database and put the add-on on white-list, but still didn't. If you go to the www.virustotal.com/en/ site, you will see that it is safe tested by 54 popular anti-virus engines; the only one reporting a worm in it is F-Secure. By the way, the F-Secure was constantly having the largest number of false positives in last few years according to the Real-World Protection Test by AV-Comparatives.

If you are interested about my other add-ons for MediaMonkey, you could visit the following page.