Adding and deleting labels with one button


I work a lot with labels and labelcategories for the mainfolders.
I use dominant labels and temporary labels. After I have done some work in a subfolder, I adjust the labelstatus of the mainfolder with certain buttons.

So first I have to select the mainfolder…
Then, I clear old temporary labels and keep the dominant ones with button 1:
Properties SETLABEL !reset LABELCATEGORY=temporary

Then I add new one(s) with button 2:
Properties ADDLABEL SETLABEL="test"

Question 1
How can I clear all labels from a certain category and add label(s) in one command/script?

Question 2
I figured out that it is possible to use above commands while I am still in the subfolder with the use of {sourcepath} in the command:
Properties {sourcepath} SETLABEL !reset LABELCATEGORY=temporary

I would like to be able to use the solution for question 1, while I still am in the subfolder.
Would that be possible?

Kind regards,

Yes, just run one command after the other:

Properties SETLABEL !reset LABELCATEGORY=temporary
Properties ADDLABEL SETLABEL="test"

(If the button editor is still in single-line mode, click Advanced at the bottom of it to go into multi-line mode.)

You can add {sourcepath} to that if you want it to label the folder you're currently in instead of the things that are currently selected below it:

Properties {sourcepath} SETLABEL !reset LABELCATEGORY=temporary
Properties {sourcepath} ADDLABEL SETLABEL="test"

Unfortunately that does not work.

My apologies, I forgot to mention that I already tried that.

With other buttons and commands multiline works, but with the label assignments it only does the last line. There is always a small delay when a label has been assigned, and it seems like the second line is neutralizing the first line.
If I even use 3 commands, only the last one will be executed.

To show you I have two examples:

This examplefolder (Situation-01.png) has 2 labels already assigned (Bewerken and Willem), these labels are both in a labelcategory called “Aanpak”.

When I use a button with a single line: Properties SETLABEL !reset LABELCATEGORY=Aanpak, both labels will be deleted.

But, when I use the 2 commands (multiline):
Properties SETLABEL !reset LABELCATEGORY=Aanpak
Properties ADDLABEL SETLABEL="On Hold"


The result will be having 3 labels (Bewerken, On Hold, Willem)

With 3 lines, only the last line seems to come through.


Are you seeing that with the latest version?

Version 12.17.

I'm trying with this command:

Properties SETLABEL=!reset LABELCATEGORY="status"

So far it always works for me:

It also seems to work fine when the two labels are part of the category that is reset:

Properties SETLABEL=!reset LABELCATEGORY="status"
Properties ADDLABEL SETLABEL="Flagged"
Properties ADDLABEL SETLABEL="Important"

I've tried with a very fast local SSD as well as a network share to an HDD, in case there's a timing issue. (Not enough tests to rule it out completely, but it seems to consistently work on everything I try.)

Thank you for the effort you already put in.

Tomorrow I will create a movie example of my results.

That could be useful in case there's as step we haven't considered.

Knowing how the labels and categories are defined might also help us recreate what you're seeing.

(Do you get the same results if you use my commands above, assuming the built-in labels and categories are still there in your config?)


So first the labelcategories I use.

I will show several buttons and their commands in action……….

Adding labels works great.
Clearing labels from category works also great, with other label(s) remaining.
Multi line label commands always end up in only processing the last line.
(I have other buttons with multiline commands and they work perfectly, renaming etc )

Just to give you more info…..

  • In your video I see you have the status icons column active. I also activated that, but same result.
  • I work with a lot of folders and files, and thousands have labels..., maybe too many?
  • I have renamed a long time ago the labelcategory status to zz-Native. I hope that does not confuse the labelsystem.
  • I think my Label Assignments database is quite big, when I open it in Preferences, the program needs some time to show.
  • I am not using label storage in the file system
  • We have several licenses of Directory Opus and on the other computers this label issue also occures, but, we all use the same config file (backup/restore). I can reset 1 Directory Opus installation to test this label issue…, but I hope to avoid that.
  • I can send you my config file

I can reproduce what you're seeing now.

It's partly due to Preferences / Favorites and Recent / Labels / Enable label storage in the file system (NTFS volumes only) and the option below it both being turned off.

That's also why opening the Preferences labels list is slow for you, since it has to list all those files/folders with labels.

But there are sometimes good reasons for having those settings turned off. It depends how you want the labels to work (and also how other software you use overwrites files that are edited). So keeping it off might still make sense, unless there wasn't a particular reason for it to be off. (It's on by default, at least in new configs.)

We'll look into why the multi-line commands aren't working correctly in this situation, since they should work no matter which way around the setting is.

We've fixed that for the next update.

Thanks for all the information you provided!

That is exactly why I cannot use file system label storage.

I look forward to the next update......
And thank YOU for your great support!!

1 Like

That fix is now available in Directory Opus 12.17.6 (Beta)

Installed the beta release. Did a few tests.
Seems to work perfectly!!
I am gone test more this weekend.


1 Like