GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Rename Month Name to Month Integer


#1

Attempting to use "Dynamic Renamer" to convert a file name without success -- to change a "month name" to its integer value.

My files are listed as:
Medical September 2013, however, I would like it to read: Medical 2013-09
Household DP September 2013 ---> Household September 2013

Any assistance will be greatly appreciated!


Dynamic Renamer
#2

NightProbe,

[ I edited this post, because my original posting was incorrect. ]

You can get this to work for the case where there is 4 digits in the year, and the years are sufficiently current. Use this for your transformation:

-dd/%Y-%m/

The reason I didn't support this mode is that this is considered an incomplete date. Since the code does not accept incomplete (ambiguous dates), it tries to parse the year as a mm-yy value. I noted this limitation here: Dynamic Renamer

In your case, the date September 2014 is being guessed as 9 for the month, 20 for the day, and 14 ==> 2014 for the year, so it will work for what I think you are doing.


#3

Thanks for the quick reply. I did use that before I decided to leave a help - without any luck.
Tried it on another folder and it worked. Go figure!

Regards


#4

MrC,

I jumped the gun when I said it works. After several test runs I have found that IF the name contain the year 2014, it will not work.
Any other year date works fine. I've worn a bald patch scratching my head trying to understand this. Would you help again?

Regards,


#5

If you can show me representative samples of your file names, I'll see what I can do.

Again, be forewarned, these date formats are ambiguous and incomplete, formats which humans generally don't have a problem recognizing or dealing with, but computer software algorithms aren't so good at it because they lack context.


#6

Thanks again and I do understand what you are saying about the limitations of this format.
Medical September 2013.txt (14 Bytes)
Household October 2014.txt (14 Bytes)


#7

Oh, sorry, I didn't mean I needed the actual files, just the representative names. Is the format always:

stuff<space(s)>MonthName<space(s)>4-Digit-Year

That is, some stuff followed by the month name followed by the four digit year?


#8

Yes, that it correct.


#9

Ok, here's what we'll have to do: 1) we'll add a 01 as the Day portion, and 2) we need to tell the date guessing code to allow future dates. This part will require the attached update (1.12pre1) to Dynamic Renamer.

Here's the transformation to do (1):

-/\s(\d{4})$/ 01 $1/

and here's the transformation to accomplish (2):

-dd/%Y-%m/f

String them together for the complete transformation:

-/\s(\d{4})$/ 01 $1/ -dd/%Y-%m/f

Note the new f (future) flag at the end of the output template. The reason your 2014 dates were failing is that you happened to try a September 2014 date which is in the future (as opposed to August or another month earlier in the year), and the code rejects future dates (the idea is that the guessing should be bounded, and file names are less likely to contain dates in the future, so values such as 01-02-2199 would be rejected as date candidates). By setting the f flag, this check is defeated.

Once you enter the complete transformation above, you can just save a Preset and recall this anytime.


_Dynamic Renamer 1.12pre1.zip (6.27 KB)


#10

@leo - this entire thread should probably be appeneded to the end of the Dynamic Renamer thread, which this post deleted.


#11

Thank you MrC. Your solution works as I needed it to. Thank you again for your time and patience.
Regards,