Adding 347 days and 12 hours to photos file name

Advanced Renamer forum
#1 : 14/01-23 16:35
Mr Jay-Asher Francis Morgan
Mr Jay-Asher Francis Morgan
Posts: 1
Hi.

Sorry, pretty new at this.

I have renamed about 50000 images into format "yyyymmdd_hhmmss", but have come to realise that one camera that was used had the incorrect date and time set. I need to add 347 days and 12 hours onto each picture. I'm not to interested in changing the EXIF data, just the file name.

EG. 20150129_023400.jpg should be 20160111_143400.jpg

Can any one point me in the right direction?

Thank you


14/01-23 16:35
#2 : 14/01-23 22:30
David Lee
David Lee
Posts: 1125
You should make some effort to check recent posts on the forum before asking questions! I've answered this many times - and twice in the past four weeks, so you would have found the answer on the first page.

Most recently on 30th December in the obviously named thread: "help about changing day and hour of thousand of files" https://www.advancedrenamer.com/forum_thread?for um_id=13251

My response is generic so just needs minor modifications to the match string and increment both Day and Hour.

Your answer...

Use a Script method with the code:

deltaDay = 347;
deltaHour = 12;
match = item.name.match(/^(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2})/);
if (match) {
Y = 1*match[1];
M = 1*match[2] - 1;
D = 1*match[3];
h = 1*match[4];
m = 1*match[5];
s = 1*match[6];
D += deltaDay;
h += deltaHour;
date = new Date(Y, M, D, h, m, s);
Y = date.getFullYear();
M = date.getMonth() + 1;
D = date.getDate();
h = date.getHours();
m = date.getMinutes();
s = date.getSeconds();
return Y + ("0" + M).slice(-2) + ("0" + D).slice(-2)
+ "_" + ("0" + h).slice(-2) + ("0" + m).slice(-2) + ("0" + s).slice(-2);
}




14/01-23 22:30
#3 : 17/01-23 17:28
Vjeetn
Vjeetn
Posts: 8
Reply to #2:
Not sure if the OP will come back but let me thank you, David Lee, for all your effort on this forum!


17/01-23 17:28