Author Topic: Finding versions that have spaces in the filenames  (Read 1692 times)

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Finding versions that have spaces in the filenames
« on: November 19, 2014, 04:44:59 PM »
Some of my very early version files have one or more spaces in the filenames, and versioning doesn't appear to find them. For instance, an original file might be 1234_IMG.JPG and the versions might be "1234_IMG edited 01 a" or 1234_IMG 01," and so on. (My initial naming conventions were pretty arbitrary.). Using the "do everything" search string mentioned in the help file doesn't appear to find them. This is what I am using: ^(_*{name})[+\-_]*[0-9|a-z]*\.(jpg|jpeg)$

How can I get this string to also find files that include spaces (or other separators) in arbitrary positions? Adding a space to [+\-_] catches the file names like "1234_IMG 01" but not "1234_IMG 01 a" or "1234_IMG 01 a edited" There are too many files involved for me to rename them with a better numbering scheme, so I hope there is a regular expression way to do this.

Also, some of the master filesnames also have spaces in them, sometimes also in arbitrary positions. Do I need to do anything special to use these as master files?

Thanks,
David
« Last Edit: November 19, 2014, 04:52:59 PM by DavidOfMA »

P.Jones

  • Sr. Member
  • **
  • Posts: 283
Re: Finding versions that have spaces in the filenames
« Reply #1 on: November 19, 2014, 07:09:13 PM »
Some of my very early version files have one or more spaces in the filenames, and versioning doesn't appear to find them. For instance, an original file might be 1234_IMG.JPG and the versions might be "1234_IMG edited 01 a" or 1234_IMG 01," and so on. (My initial naming conventions were pretty arbitrary.). Using the "do everything" search string mentioned in the help file doesn't appear to find them. This is what I am using: ^(_*{name})[+\-_]*[0-9|a-z]*\.(jpg|jpeg)$

How can I get this string to also find files that include spaces (or other separators) in arbitrary positions? Adding a space to [+\-_] catches the file names like "1234_IMG 01" but not "1234_IMG 01 a" or "1234_IMG 01 a edited" There are too many files involved for me to rename them with a better numbering scheme, so I hope there is a regular expression way to do this.

Also, some of the master filesnames also have spaces in them, sometimes also in arbitrary positions. Do I need to do anything special to use these as master files?

Thanks,
David

Try something like  ^(_*{name})[+\-_]*[0-9|a-z| ]*\.(jpg|jpeg)$

thats a | then space after |a-z

forgot to add I use

^{name}.*\.jpg$

seems to work and catches everything
« Last Edit: November 19, 2014, 07:16:31 PM by P.Jones »

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Re: Finding versions that have spaces in the filenames
« Reply #2 on: November 19, 2014, 07:19:52 PM »
Thanks. I'll try that. Is the full syntax explained somewhere? It would help to understand the logic. I haven't constructed regular expressions in many years, and the cheat sheets I've found on the web haven't clarified the logic enough for me to construct a good matching string.
« Last Edit: November 19, 2014, 07:45:03 PM by DavidOfMA »

P.Jones

  • Sr. Member
  • **
  • Posts: 283
Re: Finding versions that have spaces in the filenames
« Reply #3 on: November 19, 2014, 07:26:20 PM »
Thanks. I'll try that. Is the full syntax explained somewhere? It would help to understand the logic. I haven't constructed regular expressions in many tears.

Search Help for Versioning and Regular Expressions

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Re: Finding versions that have spaces in the filenames
« Reply #4 on: November 19, 2014, 07:48:08 PM »
Thanks. I read the help on versioning and regular expressions before I posted. From now on I'm prefacing each request with that. I only post after I can't figure out how to do something after reading the help and searching the forum, web, or both.

Just saw your addendum. I think ^{name}.*\.jpg$ should work for me, too. If I understand correctly, it means "starts with the file name, followed by any number of characters, and ends with jpg". Is that correct?
« Last Edit: November 19, 2014, 10:28:06 PM by DavidOfMA »

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1734
Re: Finding versions that have spaces in the filenames
« Reply #5 on: November 19, 2014, 11:09:58 PM »
Concerning regular expressions, there are many good sites to help you. Example: http://www.regular-expressions.info/tutorial.html
I also use RegexBuddy to test my expressions (see attached screenshot). There are other tools like it, also free ones, that are very helpful.

[attachment deleted by admin]

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30500
Re: Finding versions that have spaces in the filenames
« Reply #6 on: November 20, 2014, 03:08:35 PM »
I ave linked to several online resources in the regular expression topic in the help as well. And you can use the integrated test feature in the File Relations dialog box to test your expressions. RegExpBuddy may be a help if you really want to do something complex - but in most cases, users coming up with way to complex regular expressions.

Often a master like \.nef$ and a version like {name}\.jpg$ is all that's needed.

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Re: Finding versions that have spaces in the filenames
« Reply #7 on: November 20, 2014, 03:17:07 PM »
Thanks for the pointers to the RegEx site and the existence of RegEx tools (I've installed Expresso and will learn it.) I get the basic logic, but have one (hopefully) quick question.

Many of my masters have spaces in the filenames and include Roman numerals at the end. I have not yet been able to figure out a RegEx expression that will prevent filenames with lower Roman Numerals from matching ones with higher Roman Numerals that begin with the same letter. For instance, "Beach Rose I" matches not only "Beach Rose I" but also "Beach Rose II", "Beach Rose III", and "Beach Rose IV," and "Beach Rose I" sometimes (but not always) becomes the master of "Beach Rose II" even though a master "Beach Rose II" exists. There are similar incorrect matches with other masters that have spaces, too. I could rename all the files that have spaces so they no longer have spaces, but this would mess up several projects.

Is there, as far as you can tell, any way to have a regular expression in which "Beach Rose I" matche only "Beach Rose I" and not also "Beach Rose II" and other files that begin with "Beach" or "Beach Rose"?

Thanks,
David

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Re: Finding versions that have spaces in the filenames
« Reply #8 on: November 20, 2014, 03:27:11 PM »
On a related note, is there any way to unlike an incorrectly matched version that has been linked through a rule? I know I can unlink manual master/version links, but if I can't get this to work using a rule, in addition to linking, say, "Beach Rose III" with the "Beach Rose III" versions, I'd also like to unlink "Beach House" from "Beach Rose I."

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1734
Re: Finding versions that have spaces in the filenames
« Reply #9 on: November 20, 2014, 04:26:20 PM »
Uh, oh, roman numerals ... now that's a bad thing IMHO.
As Mario says, a simple relationship mapping {Name}\.jpg to .\nef for example should work, but if you use roman numerals, you get into trouble if someday you want to use postfixes in your filenames, like filename.nef as master an the filename.jpg and filename_web.jpg and filename_print.tif, etc as versions. Difficult then to make the difference between files like "filename II.jpg" and "filename I web.jpg" to say for which masters they are a version of ...

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Re: Finding versions that have spaces in the filenames
« Reply #10 on: November 20, 2014, 06:07:36 PM »
I created these images long before versioning was around, but now I'm stuck with them and trying to find a way to get versioning rules to work with them. Might not be possible, but I'm new to regular expressions and am putting it out there in case someone more clever than I am has an approach.

Thanks.

David

P.Jones

  • Sr. Member
  • **
  • Posts: 283
Re: Finding versions that have spaces in the filenames
« Reply #11 on: November 21, 2014, 10:46:18 AM »
I created these images long before versioning was around, but now I'm stuck with them and trying to find a way to get versioning rules to work with them. Might not be possible, but I'm new to regular expressions and am putting it out there in case someone more clever than I am has an approach.

Thanks.

David

Couldn't you rename them with a new naming system

DavidOfMA

  • Sr. Member
  • **
  • Posts: 253
  • Writer/Photographer/Therapist
Re: Finding versions that have spaces in the filenames
« Reply #12 on: November 21, 2014, 05:13:41 PM »
Many of them are linked into book projects and websites using the current names. Renaming would mean redoing all the links in the books and websites, which would be very time-consuming. Plus, there are thousands of images with about 350 masters.

I wonder if there is a way to specify that the characters after {name} NOT include the uppercase characters I,V,X. For my purposes that would distinguish Beach Rose I and Beach Rose II, which is my main problem so far.

Is there a way to say: match {name} followed by any character string EXCEPT uppercase I,V, or X? I think that will cover these images without messing anything else up, but I don't seem to be able to work out the syntax.

Thanks,
David
« Last Edit: November 21, 2014, 07:14:11 PM by DavidOfMA »