[Feature] Batch rename file from parent metadata
Will there be a context menu item "Rename attachments from parent metadata" when I multi-select top-level items?
I've tried the plugin zotero-attanger after zotfile stopped working in zotero7. It does provide the batch renaming feature, but zotero-attanger also unwantedly modifies the attachment titles.
Since the batch renaming is a relatively simple feature, I'd like to see it implemented as a built-in feature, any hope?
I've tried the plugin zotero-attanger after zotfile stopped working in zotero7. It does provide the batch renaming feature, but zotero-attanger also unwantedly modifies the attachment titles.
Since the batch renaming is a relatively simple feature, I'd like to see it implemented as a built-in feature, any hope?
You don't say why you want this, but in a future version, we'll be adding continuous renaming of the primary attachment as you edit metadata.
Even for now, I can manually multi-select all child attachments of the same parent and batch rename them. What difference does it make if I can simply click on the parent to batch rename all children? Except that I can shift-select more parent items to batch rename all their children. Otherwise I'll have to expand each of the parents and click-select each of the child attachments.
I personally tend to store version info on attachment titles and use this info inside the renaming pattern. For those who don't use complicated renaming pattern, many should have already experienced duplicate item merging that put two child attachments of the same filename under one parent.
And that poses no problem, right?
One scenario for why I want batch renaming (and in the most extreme case, for all items) is that, if I try out a new plugin that accidentally screws up all attachment filenames, I can have a simple way to reset all of them to the renaming pattern.
And I'm sure that many people have tried at the beginning one renaming pattern before they turned later to another better-suited pattern. Then they'll need a simple way to convert/rename all old files to the new pattern. Especially not by expanding each of the parents and click-selecting each of the child attachments.
But then, since this is feasible, I don't see why "there can be multiple child attachments per item" is considered to be an obstruction to having a batch rename menu on parent items.
That being said, the Advanced Search trick still can't compare to the full power of having batch rename on parent items.
Say if I want to rename the attachements of Conference Paper. I would sort by the column "Item Type", then shift-select the Conference Paper parent items to batch rename all of them.
With the Advanced Search trick, the conditions are Attachment File Type is PDF and Item Type is Conference Paper. But this wouldn't work, because the correct rule should be the Parent's Item Type is Conference Paper.
Sure I can "Include parent and child items of matching items" to obtain the desired search result, except that when I Select All, the parent items are also selected, such that the "Rename Files" context menu disappears once again.
You would expect all the attached files to be renamed from the option on the parent item, but other people could expect that only the primary attachment is renamed. Renaming all attachment files from the parent item would be very disruptive for the people who want to keep the original information on additional attachments.
You workflow is working nicely for you, but would not be compatible with the workflow of other people.
The solution described above should work. But if you prefer having a right-click option to do it from the parent item, you can modify the following script from the Actions and Tags plugin: https://github.com/windingwind/zotero-actions-tags/discussions/380
You would just need to comment the lines below if you do not want to rename also the title of the attachment files:
// Set the title without the file extension
attachment.setField('title', newName);
[I haven't tested extensively, so check on a few files if it is doing what you want.]
You can also ask for help in the discussions of that plugin if you want to modify the behaviour of the script.
I can save a search for Attachment File Type is PDF and sort them. Usually if I ctrl-A to Select All, only the PDF attachments are selected. But if I want only the Conference Paper, I'd shift-select those items, but then the parent items are also selected. As a consequence, the "Rename File" context menu wouldn't popup.
I see. That makes sense.
In my opinion, it would be better if the attachments have sub-type properties, e.g. "Full Text" / "Supplementary Material" / "Webpage Snapshot" / default untyped (independently from the attachment titles).
Kinda like the Zen of Python: Explicit is better than implicit.
Once the sub-type properties are set, the file renaming behavior can be even more transparent and user-friendly.
( But I still want to say, why not set up a hidden pref to get around the restriction and enable renaming of all children attachments? Let the users take that responsibility and the risk.
Or, a hidden pref, not for renaming all children, but less agressively, for renaming only **the** best attachment, when the Rename-File command is invoked on a parent item. )
( As for the plugin, I'll try it out, thanks!! )