Help with putting timestamp from file name

Advanced Renamer forum
#1 : 02/04-21 14:02
Jens Fridsén
Jens Fridsén
Posts: 1
Hello
This is a great tool and I'm trying to use it to put the original dates created from the filename of movies I've recently converted. But I can not understand how to use the tags and how to ignore text in the file names.

I have read the manual several times and tested but do not succeed so please help me someone who can! This is the function I try to use https://www.advancedrenamer.com/user_guide/metho d_timestamp

The file names have the following patterns
DV001_20000413-000420.mp4
and I want to ignore the first part DV001_
take the second part 20000413 and identify as the date 2000-04-13
then I want to set the same time on all files to 12:00.
So for this specifik file the Date Created should be 2000-04-13 12:00

It would have been great if you could also save the original file name in one of the file's attributes such as comment or similar.

For example i have tryd this pattern <Substr:7:8> 12:00:00 but can not get a correct format.

Would be really very grateful if I get help with this !!


02/04-21 14:02 - edited 02/04-21 14:08
#2 : 02/04-21 14:58
David Lee
David Lee
Posts: 797
Sorting out how to set timestamps from file patterns is rather like playing Dungeons and Dragons!

You can't set any of the date/time fields to specific values from the Filename pattern option so you will have to set time and date using two separate Timestamp methods.

1) Set the time with an arbitrary (valid)date...
"Absolute date and time": 1 1 1 12 0 0

2) Set the date only from the Filename pattern:
Pattern = <Year><Month><Day>

Unfortunately ARen can only set the Attributes Archive, Readonly, Hidden & System.


02/04-21 14:58 - edited 24/05-21 09:54
#3 : 24/05-21 08:25
Bruce
Bruce
Posts: 2
Reply to #2:
Hello Jens & David,

I thought something like the code below would work, but it does not. Any ideas? Presumably, JavaScript *CAN* do this!

Thanks for your time on my query,

Bruce

function(index, item) {
var cdt = new Date(2000,10,10);
item.createdDate = cdt;
return;
}

P.S. A little further down, I find this post: Set newModifiedDate in Script

I'll explore that as a possible answer and update my post!


24/05-21 08:25 - edited 24/05-21 08:31
#4 : 24/05-21 10:37
David Lee
David Lee
Posts: 797
Reply to #3:

Bruce

What you suggest should be expected to work - except you should set item.newCreatedDate.

However whilst you can modify the displayed value of "New Created Date" in ARen's List using a script, in the same way as if it had been entered using the Timestamp method, the value set in this way is not applied to the Windows timestamp when you run the batch.

I have spent hours trying to get this to work - I can only conclude that there must be a bug in the program.

Edit: I've just searched the Forum and come across posts dating back to 2014 and 2016 complaining that changes made to timestamps using scripting are not applied to the files when running the batch. In each case Kim Jensen (the developer) posted a reply but made no comment about the issue itself - instead he suggested merely that you should use the Timestamp method.


24/05-21 10:37 - edited 24/05-21 12:22
#5 : 24/05-21 22:19
Bruce
Bruce
Posts: 2
Reply to #4:
Hello David!
Thanks for the quick reply! Editing the script did not change the file date. This error was presented:
Error (124) Invalid script

While I *DID* include the closing brace ( "}" ) on my local version, I note that the choices for the script are ONLY "Name", "Extension", "Name and Extension". Thus I'm guessing the "error" was caused by the Javascript itself - the "newCreatedDate" object just is NOT part of a file name or file extension. And THAT'S why it failed... the logic is MISSING to change the file date because the drop-down button does NOT offer that function. YOUR thoughts?

The "TimeStamp" method works just fine. It's just a bit tedious when I have DOZENS of files like "aaa bbb YYMMDD ccc ddd.ext", making changing the date a one-at-a-time exercise. I can do THAT much in Windows with other apps! :-) Unfortunately, my files are NOT photos, so each file has its own create-date as part of the file name. And thus, the tedious function.

And on that thought, there is the "File Date Corrector" app found here:
https://www.infonautics-software.ch/

While it DOES what it says (create date from file name), the UI ONLY permits editing the dates for ALL FILES in a folder! This is OK in some cases, but the "delete row" option is one-at-a-time! You can NOT shift-click to remove a range of rows, to leave ONLY those files you want to change. I've written them about this as well as their code ONLY accepts the YYMMDD text pattern for a date. Whereas MMM dd, YYYY exists along with similar NON-yymmdd text.

I'm also considering a Windows PowerShell script. But then this is ALL off-base for the Advanced Renamer tool! :-)

I'll still check out the script in another forum discussion I mentioned in my previous reply.

Carry on!

Bruce


24/05-21 22:19
#6 : 24/05-21 23:51
David Lee
David Lee
Posts: 797
Reply to #5:

Bruce,

I suspect that your interpretation of the "Apply to" drop down as being the cause of the issue is probably a "red herring" since re-setting item.newPath works perfectly well. Also "New Created Date" is updated in the List in exactly the way that it would be from the Timestamp method.

I suggest that you email the developer (Kim Jensen) and report this as a bug. When the issue has previously been reported the Timestamp method would have been a better solution than using a script so there would not have been any incentive for Kim to fix the issue - so be sure to point out that in this case there is no straightforward alternative using a renaming Method.

Kim's email (linked publicly on the Support page) is: kj@hulubulu.dk


24/05-21 23:51