How do I auto-tag files… for the years 2000 to 2009?

Every now and again we get asked how to speed tagging, by creating “smart” auto-tagging rules that recognize a pattern (like a range of dates, a range of progressive numbers or a list of names).  So how do I auto-tag files whose name or path contain the years “2000” to “2010”, or a list of countries, or a sequence of order numbers or customer ids?

A very efficient and effective way to do it, is a regular expression (RegEx).

What is a RegEx?

According to Wikipedia a RegEx is “a sequence of characters that define a search pattern”. For the purpose of auto-tagging, we’ll say that a RegEx is a simple way to go from a specific name or number to be searched, to a sequence or a list of numbers that will make get the rule to triggered. A couple of examples will help, let’s say that we want to tag automatically every file whose name (or path) contains:

  • Any of the countries that constitutes the UK (England, Wales, Scotland, Northern Ireland… these files will be tagged with “UK”). This rule will do the job:    .*England.*|.*Great.*Britain|.*United.*Kingdom.*|.*Northern.*Ireland|.*Wales.*|.*Scotland.*
  • Any of the years between 2000 and 2009:  .*(200\d).*
  • The customer id, where the ids are like “C001” to “C999”:  .*C\d{3}.*
  • Files that contain “April” in the form of stuff_23-04-2010_stuff:  (?:\w*_)?\d{2}-04-\d{4}(?:_\w*)?

And if you got this far, you now know that the sky is the limit 🙂

 

Where can I find more info?

 

Where do I find this in Tabbles?

From the main menu bar you click on Tools > Auto-tagging rules, then click on New, you’ll see something like this:

automatic tagging regular expressions

 

How do I auto-tag, all the stuff that is already on my hard-disk?

Once you create an aut0-tagging rule, the rule will “listen” for new files created (or moved/downloaded) to see if the file matches or not.

But we all have tons of files, already organized in a structured system of folder… how do automatize the tagging of all of that?

You have to look for the Apply auto-tagging rules menu entry, that will appear when you right click on a folder in Tabbles. If you right-click on a disk, you have to do a step more, it will look like this:

Auto-Tagging of existing files and folders

 

What if I mess up? Any hint on how to do this properly?

When triggered, an auto-tagging rule will tag a file: technically it’s writing some lines into a database, and there is no real way to undo this…

Therefore, if you’re new on this, you’re not sure what you’re doing, or you’re testing a complex RegEx, you’d better take precautions when testing auto-tagging rules:

  1. Always use a test tag. If the rule worked, you can re-route it to the real tag(s) in a few clicks. If it didn’t work, you can delete the tag and try again.
  2. Always use one tag: don’t succumb to the temptation of tagging everything at once! Eventually you’ll get there, but don’t rush 🙂
  3. Start easy and do not mix things: keep the rules minimal and avoid combining too many things (e.g. a word in the content along with a RegEx on the path). Better split the auto-tagging in two or more rules, as it will be easier to work on later on.

 

Read more about auto-tagging on the user manual.

 

Have fun with auto-tagging! 🙂