Page 1 of 1
How to batch edit catalog directory path?
Posted: Sat Oct 18, 2025 5:46 pm
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.
Re: How to batch edit catalog directory path?
Posted: Sat Oct 18, 2025 6:04 pm
by user0
Re: How to batch edit catalog directory path?
Posted: Sat Oct 18, 2025 6:41 pm
by lilith
Thank you!

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?
Re: How to batch edit catalog directory path?
Posted: Sun Oct 19, 2025 12:25 pm
by user0
try
1. place the following files in the same folder
- 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