How to fix missing metadata after moving files

Frequently Asked Questions regarding XnView (including Answers)

Moderator: xnview

User avatar
user0
XnThusiast
Posts: 3117
Joined: Sat May 09, 2015 9:37 am

How to fix missing metadata after moving files

Post by user0 »

     
APP SETTINGS
When you modify metadata using the overlay icons in the Browser or the Metadata > Set... menus,
XnView MP saves the metadata according to the following settings:
- Export settings in Settings>Metadata for files that support embedded metadata.
- Sidecar settings in Settings>Metadata>Sidecar for files that do not support embedded metadata (eg RAW files).

By default, app writes only Categories (Keywords) to files.


ISSUE
If you move or rename files using an external file manager (like Windows File Explorer or macOS Finder), XnView MP will lose the link to the metadata stored in its database. This includes checks, ratings, color labels and keywords.

For example, if you move the parent folder:
  • from
    D:/Photos_OLD/2024/2402/240219_event_name/
  • to
    E:/Photos_NEW/2024/2402/240219_event_name/


SOLUTION
To resolve this, the file paths in the XnView MP database need to be updated to match the new location.

Option A - one by one
  1. prerequisites
    • make backup of your XnView.db
    • rename current root folder with your images (eg Photos_NEW to Photos_NEW1) and do not open any image inside with XnView.
      You need to make sure that XnView has not indexed this new location.
  2. goto Settings > Catalog
    • select single folder
  3. press Relocate button
    • update new Path
      Note: it is case sensitive
    • press OK

Option B - batch processing - export/import
  1. prerequisites
    • make backup of your XnView.db
  2. Export catalog
    • press Export... (Browser tab > File > Catalog)
    • set .xml file via ... button
    • check 'Export Rating & Color labels' checkbox
  3. Edit exported catalog
    • open .xml file in text editor (eg Notepad)
    • Replace old path with new
      Note: it is case sensitive
    • Save .xml file
  4. Import catalog
    • press Clear&Import... (Browser tab > File > Catalog)
    • press OK in confirmation popup

Option C - batch processing - db editing
  1. prerequisites
    • make backup of your XnView.db
    • rename current root folder with your images (eg Photos_NEW to Photos_NEW1) and do not open any image inside with XnView.
      You need to make sure that XnView has not indexed this new location.
  2. open XnView.db in db tool
  3. (optional) open Browse Data tab
    • select Folders table
    • check pathnames (you can edit them one by one, but its slow)
      DBBrowser4SQLite_BrowseData_Folders.png
  4. Execute SQL query
    • open Execute SQL tab
    • paste query
      Note: use Slash and not Backslash, paths are case sensitive

      Code: Select all

      UPDATE Folders
      SET Pathname = REPLACE(Pathname, 'D:/Photos_OLD', 'E:/Photos_NEW1')
      WHERE Pathname LIKE 'D:/Photos_OLD%';
      
      DBBrowser4SQLite_ExecuteSQL.png
    • press Ctrl+Enter
  5. Write changes to db
    • press Ctrl+S
You do not have the required permissions to view the files attached to this post.