Automatically copy keywords for multiple files

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

Moderators: XnTriq, helmut, xnview

aaa124
Posts: 4
Joined: Mon Mar 04, 2024 6:06 am

Automatically copy keywords for multiple files

Post by aaa124 »

My situation:
I use XnViewMP on a laptop with a small hard drive. Consequently, I store high-resolution originals on an external hard drive and keep a smaller version of all files on the laptop.

The file directory structure and individual image filenames are identical on both the external hard drive and the laptop. Additionally, the files are extensively tagged with hierarchical keywords; the keyword thesaurus used is identical across both drives.

My problem:
While the intention was for the external hard drive to serve as the master copy, with the laptop acting as a slave that could be easily regenerated, I have inadvertently added additional tags to the laptop versions. This has resulted in the "slave" actually being more up-to-date than the "master" in terms of keyword information.

My question:
Is there a way to automatically apply the updated keywords from the JPEG images stored on the laptop to their corresponding master versions on the external hard drive?

Thank you for suggestions,
Michael
User avatar
michel038
XnThusiast
Posts: 1292
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Automatically copy keywords for multiple files

Post by michel038 »

Perhaps :
Backup xnview.db
With a db editor, change paths for the the files from HDD to external hdd in this db file.
Start XnViewMP, check if catalog filter is able to show a file from hdd
Select files to be updated
View>update files from catalog.
When ended, close Xn and restore original xnview.db.

Another way :
Instead of replacing paths in the db, change " Base path" (Settings > catalog)
But It's risky, and I wouldn't recommend it unless Pierre (Xnview) confirms that it's possible and reversible.
aaa124
Posts: 4
Joined: Mon Mar 04, 2024 6:06 am

Re: Automatically copy keywords for multiple files

Post by aaa124 »

michel038: thank you. If the 2nd suggestion works, it's obviously much simpler as it does not require understanding of the internal structure of the database and bulk manipulation of data in the database. Do you know if there is any description of what "base path" is and how it's used? (a couple of posts that I found were not of much help)
User avatar
michel038
XnThusiast
Posts: 1292
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Automatically copy keywords for multiple files

Post by michel038 »

After years of use and testing, I still haven't fully understood the role and use of the "base path".

Keep a copy of xnview.db is a good idea when trying some operations..

Your categories (= the catalog = database = xnviex.db) are always exported as keywords, yes ? So if the catalog is damaged, you can rebuild it with Settings>Catalog> add folder, with import options enabled in Settings>Metadata.

... hope Pierre can give you some advice
User avatar
xnview
Author of XnView
Posts: 43613
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Automatically copy keywords for multiple files

Post by xnview »

michel038 wrote: Mon Mar 04, 2024 10:08 am After years of use and testing, I still haven't fully understood the role and use of the "base path".
For example, if on a computer, your photos folder is '\\Volume\users\pierre\photos' and on another it's c:\photos'. You can set base path '\\Volume\users\pierre' & 'c:\' so only relative paths will be stored 'photos/*'
Pierre.
aaa124
Posts: 4
Joined: Mon Mar 04, 2024 6:06 am

Re: Automatically copy keywords for multiple files

Post by aaa124 »

Pierre,

So would this solution work?

1. Set base path to c:/photos and build a catalog from small files stored on the laptop.
2. Change the base path from c:/photos to f:/photos, i.e. point it to the external hard drive. All relative paths should match, given that my file names and folder structure is identical on two drives.
3. Do View>Update files from catalog for the necessary subset of files to push newer keywords from catalog to jpegs on the external hard drive.
4. Change base path back to point to c:/photos.

I would appreciate if you could confirm if that is a viable solution.
Thank you.
User avatar
michel038
XnThusiast
Posts: 1292
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Automatically copy keywords for multiple files

Post by michel038 »

I tried today, it's working fine.
But I have set the parent folder in base path.
In your example if you enter "C:\photos" as base path, you will have to select each subfolder, one at a time, to build the catalog. (maybe possible)
(selecting c:\photos in "import folder" does not work very well when c:\photos is selected as base path)

I suggest for your example :
1. Set base path to c:/ and build a new catalog from small files stored on the laptop with import options enabled
2. Change the base path from c:/ to f:/ i.e. point it to the external hard drive. All relative paths should match, given that my file names and folder structure is identical on two drives.
2b.Try catalog filter to ensure that new paths are ok
3. Do View>Update files from catalog for the necessary subset of files to push newer keywords from catalog to jpegs on the external hard drive with export options enabled
4. Change base path back to point to c:/

My last tests for "Base path" were carried out some years earlier ...
Thank you Pierre for this simple and obvious but necessary information
aaa124
Posts: 4
Joined: Mon Mar 04, 2024 6:06 am

Re: Automatically copy keywords for multiple files

Post by aaa124 »

Thank you for your help, it worked! "Update files from catalogue" doesn't actually update files for some reason, but I solved it by assigning and unassigning a category, which forced writing of all keywords into images.