Hi
I’m using XnView MP and batch renaming files with {Categories} in the filename template.
Currently, categories are always inserted in alphabetical order, regardless of their hierarchical structure. What I need instead is the hierarchical order as defined in the category tree.
Example:
Defined hierarchy in the Catalog:
W… > D…
Result during batch rename:
D…, W…
Desired result:
W…-D…
The hierarchy is clearly present in XnView MP’s category tree, but it appears to be flattened and alphabetically sorted during batch renaming.
I’ve also tested {XMP:Subject}, {XMP:HierarchicalSubject}, and {IPTC:Keywords}, but these show similar behavior: either only parent categories are shown, or parent + parent/child categories are flattened together.
Is there any way to preserve or control the hierarchical category order during batch rename?
Or is this simply a limitation, and not configurable via a setting?
Thanks!
Batch rename: preserve hierarchical category order instead of alphabetical
Moderator: xnview
Re: Batch rename: preserve hierarchical category order instead of alphabetical
sorry but currently no way
Pierre.
Re: Batch rename: preserve hierarchical category order instead of alphabetical
v-v.c,v-v.c wrote: Sun Jan 04, 2026 12:23 pm Is there any way to preserve or control the hierarchical category order during batch rename?
If you are strongly motivated to do this, and are willing to put some effort into it, I suggest you look at Advanced Renamer.
https://www.advancedrenamer.com/
This is an extremely sophisticated renaming utility. I know of no tool that is more capable. It's free. It supports scripting in JavaScript to manipulate metadata as part of renaming.
They have a support forum there. Someone should be able to help you do it.
A prerequisite will be that the metadata (your categories in this case) can’t be private XnViewMP data, it needs to be metadata stored in the image file or an XMP sidecar file. So I would start by ensuring your categories are exported as XMP:HierarchicalSubject.
Ask on their support forum how you can leverage xmp:HierarchicalSubject in a script to do what you want.
As an aside, hardcoding metadata into filenames in this way is not really a good practice unless there is a very specific need, so I would encourage you to think hard about whether this is necessary or if there’s not a better way to achieve your true goal. I suspect the renaming you propose is a means to an end, like being aware of subjects in an app that does not support metadata.
Hopefully this helps. Good luck.