Renaming pictures with fileinfo Qs

Hi, I have a couple of renaming questions that I can't quite work out.

This is my button, which will rename my pics in this format: "2009-09 - mylabel - 001.jpg"

@nodeselect Rename FILEINFO FROM "*.*" TO "{shootingtime|D#yyyy-MM} - {dlgstring|Enter label...|{clip}} - .{ext}" NUMBER=001

  1. I tried to replace {clip} with {parent} to get the parent folder name in the dialog box text entry field. It just shows as "{parent}" though. Is this not possible for dialog boxes?

  2. How would I make it work on selected files only? At the moment it works on all files.

  3. If no shooting time exists, files will be renamed as:
    " - labelhere - 001.jpg"

    In this case can I tell the button to use 0000 instead of nothing?
    "0000 - labelhere - 001.jpg"

    Or, could I tell it to remove the first dash, so it'd look like this:
    "labelhere - 001.jpg"

  4. If I don't enter a label/title the output will look like this:
    "YYYY-MM - - 001.jpg"

    Can I tell it to remove double dashes at the end, or make them one, at the end?

The {dlgstring ...} part is parsed before the Rename command itself gets run and whatever {dlgstring ...} turns into is given to the Rename command.

{parent} is a file information (FILEINFO) code for the rename command, but not something recognised by Opus outside of the rename command.

Instead, of {parent} use {filepath|..|nopath|noterm}

Use PATTERN instead of FROM.

Combining the two answers so far:

@nodeselect Rename FILEINFO PATTERN "*.*" TO "{shootingtime|D#yyyy-MM} - {dlgstring|Enter label...|{filepath|..|nopath|noterm}} - .{ext}" NUMBER=001

[quote]3. If no shooting time exists...
4. If I don't enter a label/title...[/quote]

If you want conditional logic and/or clean-up you can either:

  1. Use a rename script to clean-up the result using VBScript or similar.

OR

  1. Add a additional Rename lines which perform the clean-up by removing the unwanted patterns, e.g. " - " at the start of names.

Amazing thanks leo. I do have a vbscript which cleans it up. But I will try some more rename patterns in the button itself and see if I can get it to do it all in one hit.

I had tried adding this to the end but it did nothing at all. I think because each of the dashes have spaces around them. not sure.

Rename PATTERN="-  -" TO="  -  " FINDREP

I have some more ideas to try though.

And that parent name is great! I would never have known. Didn't think I was going to get around it without vb!

One more thing :

[quote]
@nodeselect
Rename FILEINFO PATTERN "." TO "{shootingtime|D#yyyy-MM} - {dlgstring|Enter label...|{filepath|..|nopath|noterm}} - .{ext}" NUMBER=001[/quote]

It wants to do one file at a time. I have to enter a name for each file. Can I get it to do the title once for all files?

You can put rename scripts into buttons so it'd still do things in one hit. There are a few examples in the Rename Scripting area of the forum.

Try {sourcepath|nopath|noterm} instead of {filepath|..|nopath|noterm}

Thanks again leo.

[code]@nodeselect

Rename FILEINFO PATTERN "." TO "{shootingtime|D#yyyy-MM} - {dlgstring|Enter label...|{sourcepath|nopath|noterm}} - .{ext}" NUMBER=001
[/code]

Tried this, still wants to do one file at a time.

Any more ideas?

This seems to work:

@nodeselect @set label={dlgstring|Enter label...|{sourcepath|nopath|noterm}} Rename FILEINFO PATTERN "*.*" TO "{shootingtime|D#yyyy-MM} - {$label} - .{ext}" NUMBER=001

Thanks a ton leo for doing this, that works very nicely.