INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to renumber the filename?  (Read 3229 times)

cron0sRXR8

  • Galactic Citizen
  • ****
  • Posts: 296
How to renumber the filename?
« on: November 10, 2015, 02:56:28 pm »

Hi,

I want this:

FIELD: filename.

NAME 00001.mp4
NAME 00002.mp4
NAME 00003.mp4
...
NAME 0000N.mp4

How to do it?

NAME Math(0 + customdata(#)) ==> I need 5 digits!

Thank you!

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: How to renumber the filename?
« Reply #1 on: November 10, 2015, 03:59:58 pm »

You can have MC generate a counter using the Counter() expression.  It trims leading zeroes by default, but you can combine it with PadNumber() to achieve that.

So, this would do the counter part:
PadNumber(Counter(),5)

Now, I'm unclear what you mean by NAME in your examples, so it is impossible to tell you exactly what you need to do. If you mean the [Name] field, then you can do this:

1. Make sure the files are shown in the proper order, and that only those files are visible in the View. The easiest thing is to put them in a Playlist all by themselves. This is because the Counter() will apply to all files visible in the view when you use it in Rename, Move, and Copy Files, not just the ones sent to the tool.
2. Select the files, and then open Rename, Move, and Copy Files and put it in Rename mode.
3. Enable only the Filename Template, and enter this for the rule: [Name] PadNumber(Counter(),5)
4. Apply the change if the Preview panel looks correct.

If by NAME you mean not the [Name] field, but the current Filename, then use this instead in the Filename Template Rule:
Filename(,0) PadNumber(Counter(),5)

The Filename() expression function has an optional mode that spits out the filename without the Extension. Filename(,0) does this. Note the comma before the zero, however, which tells it to work on the currently selected file.

If you need to force the counter to start at a particular digit, then specify the digit in the Counter() part.  So, if you want:
NAME 00007
NAME 00008
NAME 00009
NAME 00010
NAME 00011
etc

Then you'd use this for the number generation part: PadNumber(Counter(7),5)
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

cron0sRXR8

  • Galactic Citizen
  • ****
  • Posts: 296
Re: How to renumber the filename?
« Reply #2 on: November 17, 2015, 04:38:06 pm »

thank you for the information!

I want put a fix filename, it is

any-text ### :

any-text 00001
any-text 00002
any-text 00003
...
any-text 0000N

is it "any-text PadNumber(Counter(),5)" ?
then i try this and I put the mouse over the text the number change! it is a bug!
the counter number of preview change when i put the point of the mouse up to the text.


Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: How to renumber the filename?
« Reply #3 on: November 17, 2015, 09:19:24 pm »

I can confirm that trying to use Counter() in the Rename, Move, and Copy tool doesn't seem to work.  As Cron indicated, the number changes every time you get the mouse over it.  Pretty weird in a mildly entertaining way.  :)

Cron:  Try this instead:

any-text PadNumber(Customdata(#),5)

That should do what you want.

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: How to renumber the filename?
« Reply #4 on: November 17, 2015, 09:33:03 pm »

I tested it when I posted the above, and I saw the behavior I described above, but not any "on mouseover" changes.  Though that was a while back, and I might have tested in the Windows version. I remember clearly because I thought this bit was particularly odd:

This is because the Counter() will apply to all files visible in the view when you use it in Rename, Move, and Copy Files, not just the ones sent to the tool.

In any case, it would be best, almost certainly, to only fill the filename with something you have somewhere in the tags. So I'd never do it directly inside RMCF anyway. A better method would almost certainly be to:

1. Make a new [Serial Number] field if you have to, or use something existing (like [Episode] perhaps) that isn't otherwise being used for these files.
2. Apply your Counter() there, and make sure the tags are all right and the way you want them.

Then just do this in the RMCF tool: any-text PadNumber([Serial Number],5)

Brian's solution is clever, but I still probably wouldn't use it. Better to have it in a tag. You might need it, or want to change it later. And Counter() certainly works predictably when editing all of the regular fields in MC (I use it all the time).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8972
Re: How to renumber the filename?
« Reply #5 on: November 17, 2015, 11:51:34 pm »

That's how counter works unfortunately. It resets after 5 seconds of inactivity, but if you keep running the mouse over any list generated using it, the numbers will keep on going....

For the RMCF tool, you want the next one down, CustomData()...

any-text padnumber(customdata(#), 5)
or
[name] padnumber(customdata(#), 5)

this will return a numbered list that doesn't increase ad-infinitum when you mouse over it. All you have to do is ensure the files are listed in the order you want them to begin with.
Note that this expression function only works in the RMCF tool.

-marko.
Pages: [1]   Go Up