Renaming/Regexp help


my first post, my first question... :wink:

I want to rename serveral files per button.

There are two kinds of avi's, i want to rename

  1. "s01e03_some_kind_of_episode.avi"
  2. "yet_another_avi_file.avi

No. 1) should be after renaming "S01E03 - Some Kind Of Episode.avi"
No. 2) should be renamed like the parent folder (for example "Parent Folder.avi")

My problem is now, that i don't know how to write a regexp, which catches all files who DON'T start with "s[0-9]{2}e[0-9]{2}".

I tried this, but it doesnt work, it catches all avi, even No. 1)
Rename TYPE=files PATTERN "^(?!s[0-9]{2}e[0-9]{2}).*" REGEXP TO "parentfolder"

Can anyone please help?

Thanks in advance,

The following 4 screen grabs should show you how to do it either with button commands or the advanced rename dialog box.

Actually now that I think about it more, the following screen grab would probably be a better RegEx for renaming

s01e03 - some_kind_of_episode.avi

hey john,

thanks for the screenshots, but i would like to perform both rename-actions with one button...

so i wrote two rename operations in the script editor, first catches all files which includes e.g. "s02e11"... this part does it's job like it should...

but my main problem is that i don't know, how to write an regexp which catches all files, except those who begin with e.g. "s02e11"...

i hope you understand what i want... :wink:



i think, i found out what's the problem here...

it seems, that directory opus isn't able to handle lookaheads as described here:

but i think the following regexp should somehow work too:

i'll try this tomorrow, thanks!

No, Opus doesn't handle lookaheads, it's a very basic RegEx. Leo can tell you the flavor of it I believe, but the bottom line is what you see in the help file about RegEx is what Opus can do with it.

I have to admit I'm back in the weeds again when it comes to understanding just what it is you're trying to do here, but hopefully you're getting it worked out.

You're better off using a rename script if you want to do anything involving conditional logic.

You can use anything supported by ActiveScript, e.g. VBScript, Javascript, Perl... There's a few threads you'll find useful in the rename scripting forum if you want to go that route.

I tinkered a bit with your results and found this.Rename REGEXP PATTERN="(^[a-zA-Z0-9]+)( - )?(.*)_(.*\..*)#" TO="\1 - \3 \4" type=files

Rename REGEXP PATTERN="([^_ ]+)( - )?(.*)_(.*\..*)#" TO="\1 - \3 \4" type=files

There's still hope, but not quite as paul intended.