Unbelievably flawless!
Thank you.
I do realize now that I have a follow - up. Would you prefer I post in this thread, or create a new question? I'm fine either way.
Main Topics
Browse All TopicsI have a few thousand jpg files and I have them named by the EXIF Date of the camera, using a tool called "ReNamer" (http://www.den4b.com/down
So my files are named in the format 'yyyymmddhhmmss'
Example:
20090521021518.jpg
20090522072110.jpg
and so on...
The problem is that my camera, the date was set one day LATER than the ACTUAL day, so in reality, the above should actually be:
20090520021518.jpg (i.e. May 20)
20090521072110.jpg (i.e. May 21)
and so on...
ReNamer is pretty slick and had a pre-existing pascal script called "Hours Span" which I tweaked to something like the code attached, and it worked beautifully. I did this to change the hours of the of the same files. Sadly it didn't have a built-in "Days Span" pascal script.
I was wondering if anyone here could help me out with a "Days Span" pascal script. Again, I've attached the code snippet of the "Hours Span" with this thread as a reference.
Also, I've attached ReNamer's help guide (pdf) if needed.
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Oops..already asked... but link is here:
http://www.experts-exchang
Need more coffee...sent you the wrong url.
This is the one with the follow-up: http://www.experts-exchang
Business Accounts
Answer for Membership
by: JosephGloszPosted on 2009-05-26 at 19:09:55ID: 24479461
this should do. Since the rest of the code works well, as you say, we'll simply reuse as much of it as we can. Here, we are adding a procedure called AddDays and it'll hook into the rest of the code.
OfDays*Hou rsPerDay);
1, 4), -1); 5, 2), -1); 7, 2), -1); 9, 2), -1); 11, 2), -1); 13, 2), -1);
ormat, DateTime) + FileName;
const
HoursSpan = -1; // amount of hours to add or subtract!!
DateOutputFormat = 'yyyymmddhhnnss'; // output date format!!
HoursPerDay = 24; // do not change this!!
DaysSpan = -1;
var
iYear, iMonth, iDay, iHour, iMin, iSec: Integer;
Date, Time, DateTime: TDateTime;
procedure AddHours(var ADateTime: TDateTime; const ANumberOfHours: Integer);
begin
ADateTime := ((ADateTime * HoursPerDay) + ANumberOfHours) / HoursPerDay;
end;
procedure AddDays(var ADateTime: TDateTime; const ANumberOfDays: Integer);
begin
AddHours(ADateTime,ANumber
end;
begin
// extract date-time variables as integers
iYear := StrToIntDef(Copy(FileName,
iMonth := StrToIntDef(Copy(FileName,
iDay := StrToIntDef(Copy(FileName,
iHour := StrToIntDef(Copy(FileName,
iMin := StrToIntDef(Copy(FileName,
iSec := StrToIntDef(Copy(FileName,
// process only if all variables are correctly converted
if (iYear >= 0) and (iMonth >= 0) and (iDay >= 0) and
(iHour >= 0) and (iMin >= 0) and (iSec >= 0) then
begin
// create a new date-time variable
Date := EncodeDate(iYear, iMonth, iDay);
Time := EncodeTime(iHour, iMin, iSec, 0);
DateTime := Date + Time;
// add hours (use minus for subtracting)
// AddHours(DateTime, HoursSpan);
AddDays(DateTime, DaysSpan);
// concatenate the rest of the filename and the new date
FileName := Copy(FileName, 20, Length(FileName));
FileName := FormatDateTime(DateOutputF
end
// something went wrong
else FileName := 'INVALID INPUT';
end.