#1 Yesterday 12:31

Remane123
Member
Registered: Yesterday
Posts: 2

9000 survey photos wrong KP in file name

I have 9000 survey photos of the KP is by 9m, All images need renaming with +9 to the KP no. Got stuck with this.

KP_4.293 202509212151573 Field Joint DVR-4364_Ch4 (e.g _KP4.302 202509212151573 Field Joint DVR-4364_Ch4)
KP_4.303 202509212152543 Anode DVR-4364_Ch1
KP_4.303 202509212152543 Anode DVR-4364_Ch2
KP_4.303 202509212152543 Anode DVR-4364_Ch4
KP_4.305 202509212153083 Field Joint DVR-4364_Ch1
KP_4.305 202509212153083 Field Joint DVR-4364_Ch2
KP_4.305 202509212153083 Field Joint DVR-4364_Ch4

Offline

#2 Yesterday 13:58

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,506

Re: 9000 survey photos wrong KP in file name

There is no easy rule to do that yet, but this can be done with a bit of Pascal Script.

Basically, it find the first number between a dot and a space, and adds 9 to it.

var
  StartPos, EndPos, Number: Integer;
  NumberStr: String;
begin
  StartPos := WidePos('.', FileName);
  if StartPos > 0 then
  begin
    EndPos := WidePosEx(' ', FileName, StartPos + 1);
    if EndPos > 0 then
    begin
      NumberStr := WideCopy(FileName, StartPos + 1, EndPos - StartPos - 1);
      if TryStrToInt(NumberStr, Number) then
      begin
        Number := Number + 9; // Adjust the number here
        WideDelete(FileName, StartPos + 1, EndPos - StartPos - 1);
        WideInsert(IntToStr(Number), FileName, StartPos + 1);
      end;
    end;
  end;
end.

The resulting filenames will be:

KP_4.302 202509212151573 Field Joint DVR-4364_Ch4
KP_4.312 202509212152543 Anode DVR-4364_Ch1
KP_4.312 202509212152543 Anode DVR-4364_Ch2
KP_4.312 202509212152543 Anode DVR-4364_Ch4
KP_4.314 202509212153083 Field Joint DVR-4364_Ch1
KP_4.314 202509212153083 Field Joint DVR-4364_Ch2
KP_4.314 202509212153083 Field Joint DVR-4364_Ch4

Offline

#3 Today 03:24

Remane123
Member
Registered: Yesterday
Posts: 2

Re: 9000 survey photos wrong KP in file name

Thanks, i dont know Pascal, i will try with Python...

Offline

Board footer

Powered by FluxBB