#1 2007-01-05 17:22

thedb
Member
Registered: 2007-01-05
Posts: 1

Help numbering files

Hi,

I have a folder of files where there are 2 versions of each filename - but with different extension e.g:
test.raw
test.jpg
sample.raw
sample.jpg

I want to rename the files to replace the original filename with a numerical sequence e.g.
001.raw
001.jpg
002.raw
002.jpg

Any ideas?

Thanks

Dave

Offline

#2 2007-01-10 03:08

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

Re: Help numbering files

Hi Dave,

Sorry for such a late reply, I've been away for last 2 weeks. Anyway, similar problem have been discussed and solved in this topic: Rename "buddy" files, like .thm, produced by digital camera. You can reuse the script posted in that topic: add only RAW files, set up Incremental Serialization with padding, then add the script below as the last rule BUT uncheck it and only check back on when you are comfortable with the new names. JPG files will be renamed when you press Preview, and then press Rename button to rename RAW files.

Please, try it on some test files first, before applying to the real files, because modifications to the "buddy" files will be done on Preview!

const BUDDY_EXT = '.jpg';
var NewName, Buddy, NewBuddy: WideString;
begin
  Buddy := WideChangeFileExt(FilePath, BUDDY_EXT);  
  if WideFileExists(Buddy) then
    begin
    NewName := WideExtractBaseName(FileName);
    NewBuddy := WideExtractFilePath(FilePath) + NewName + BUDDY_EXT;
    WideRenameFile(Buddy, NewBuddy);
    end;
end.

Last edited by den4b (2007-01-10 03:15)

Offline

Board footer

Powered by FluxBB