How to batch edit catalog directory path?

Ask for help and post your question on how to use XnView MP.

Moderators: helmut, xnview

Post Reply
lilith
Posts: 2
Joined: Sat Oct 18, 2025 5:34 pm

How to batch edit catalog directory path?

Post by lilith »

when I restore catalog data from other pc or os, I need to relocate many directory path with the same prefix path, i feel like a stupid manually relocate each path one by one, thinking there must be a way to do this but I don't know how... i tried googled this but not getting what i need.
User avatar
user0
XnThusiast
Posts: 2576
Joined: Sat May 09, 2015 9:37 am

Re: How to batch edit catalog directory path?

Post by user0 »

lilith
Posts: 2
Joined: Sat Oct 18, 2025 5:34 pm

Re: How to batch edit catalog directory path?

Post by lilith »

Thank you! :D it helps replacing simple syntax with your code provided, but sql code is beyond my knowledge if i need to edit it with more function like incremental number, is there a way to export a specific table like this one into txt file, edit with a text editor then import the changes?
User avatar
user0
XnThusiast
Posts: 2576
Joined: Sat May 09, 2015 9:37 am

Re: How to batch edit catalog directory path?

Post by user0 »

try
1. place the following files in the same folder
  • XnView.db
  • sqlite3.exe from sqlite-tools-win-x64-3500400.zip download from sqlite3
  • create files
    • export_folders.bat

      Code: Select all

      sqlite3.exe XnView.db < export_folders.sql
    • export_folders.sql

      Code: Select all

      .mode csv
      .separator ","
      .headers on
      .output export_folders.csv
      SELECT FolderID, Pathname FROM Folders;
      .output stdout
    • import_folders.bat

      Code: Select all

      sqlite3.exe XnView.db < import_folders.sql
    • import_folders.sql

      Code: Select all

      DELETE FROM Folders;
      
      .mode csv
      .separator ","
      .import export_folders.csv Folders
      
      UPDATE sqlite_sequence
      SET seq = (SELECT MAX(FolderID) FROM Folders)
      WHERE name = 'Folders';
2. run export_folders.bat
3. modify export_folders.csv (edit only Pathname values and they must remain unique)
4. run import_folders.bat
Post Reply