Release time and date from filename.

Have a bunch of old podcasts, with no release time or date but with a filename of:

060210 - FILENAME.mp3

where 060210 is a date of 10th February 2006.

I wish to know how I could go about batch processing these files so that they have a correct releasetime and releasedate according to the particular date at the beginning of the filename. So for that file in particular, it would have a releasetime and releasedate of 10th February 2006 in the format of YYYY-MM-DDThh:mm:ssZ.

Another question, I have another batch with filenames of:

01 - 2001-11-10
02 - 2001-11-17
03 - 2001-11-24

and I wish to do the same as above, with releasetime and releasedate.

I would be eternally grateful if someone could help me, this is a bit too complicated for me.

For 060210 - FILENAME.mp3 you can use an action or tag-tag :mt_ttt: like:


Format string: $regexp(%_FILENAME%,^([0-2][0-9])(\d\d)(\d\d).+,$3-$2-20$1T12:00:00Z)

BUT it seems this doesn't work as it should. This regexp should only match a year which is 2000 up to 2029 but I believe there is a bug and it returns unfavoured results.

2. So you can use this instead and for RELEASEDATE also: Field: RELEASETIME

Format string: $regexp(%_FILENAME%,^(\d\d)(\d\d)(\d\d).+,$3-$2-20$1T12:00:00Z)

But be careful that you only run it on 2000 year upwards. The time format is 12:00:00. It's just adding a dummy time in but iTunes can read the RELEASETIME without that there so it's optional. It all depends on the software/players you use.

3. For filenames with 01 - 2001-11-10.mp3 use in the format field for RELEASETIME and RELEASEDATE: $regexp(%_FILENAME%,.+?\s-\s(\d\d\d\d)-(\d\d)-(\d\d)$,$3-$2-$1T12:00:00Z)

As I've said example 1 doesn't work as it should. Example 3 works in an action but no.2 example does not. Having said that they all do in the tag-tag :mt_ttt: :unsure:

When in an action example no.2 formats the fields with all the info from the _FILENAME whereas in tag-tag it does not. Also I'd like if someone could try out the no.1 action too that would be great or know why it doesn't work. See attached my troublesome action.
_Script_Test_TEST_madmadra.mta (433 Bytes)

_Script_Test_TEST_madmadra.mta (433 Bytes)

Thanks, just testing methods with a tag-tag and previewing:

1st will give:

050819  - FILENAME.mp3  >>>> 08-05-20T12:00:00Z 

2nd will give:

050819  - FILENAME.mp3 >>>> 19-08-2005T12:00:00Z

Sorry if I didn't highlight this well, but the 050819 is actually the 19th of 8(August), 2005

so not sure how to get it in YYYY-MM-DDThh:mm:ssZ or, 2005-08-19T12:00:00Z

As for the 01 - 2001-11-10.mp3 files, I previewed the third option and it seemed to work perfectly.

Thanks a lot, this would save me probably days of painful typing. :astonished:

Yeah first action should work on years 2000 to 2029 or 1900 to 1929 lol but it doesn't.

Sorry to fix that use:

This is amazing. I'm really pushing it now, but this is the last thing I will ever need. One more string to fix the date but this time the filename is:

  1. ATT 30.01.13
  2. ATT 31.01.13
  3. ATT 01.02.13

By the way, I was examining the string you gave me to fix 01 - 2001-11-10.mp3, which worked great, to try figure out what string to make for 15. ATT 01.02.13 as I thought I should be able to figure it out, as the only difference is the 15. ATT 01.02.13 but I can't really do it. I was looking at to figure out how to do this but I'm really bad at this stuff. I could make out that \s-\s corresponds to ' - ' but was not sure what the ,.+? was supposed to mean.

This is similar to the 2nd option I gave in my 1st post. Only I had a ^ at the start of that regexp. This anchors whatever the remaining regexp is from the very start of th text string.

For this one you can modify your 060210 - FILENAME.mp3 fix by changing:




The . matches any character at all and the + is a quantifier which means any number from 1 to infinity. If you used * it would be 0 to infinity. The \sATT\s matches one whitespace char then ATT then \s again. If you wanted to get fancy you could place (?-i) anywhere in the regexp and it will only match with case sensitivity. The . matches the . char specifically. Then $ anchors to the end of the text string so this will not work for '13. ATT 30.01.13 something other text here'

Different strings to find mean different regular expressions of course and the more you practice the better you get. There are many places to find good info:

I just goggled 'reg expression explained' and loads came up.

and to test your reg exp: