ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

File Renaming: Renumbering by Calculation (e.g. even, odd)?


Tried to figure out a simple way to renumber files of the form:

  000.ext, 001.ext, 002.ext, ...


  000.ext, 002.ext, 004.ext, ...


  001.ext, 003.ext, 005.ext, ...

What I ended up with was a multi-step process involving among other things, custom PascalScript via den4b's ReNamer.  For reference, the PascalScript part for even renumbering (plus prefix) was:

--- ---var
  i: Integer;
  Number: String;
  Number := Copy(FileName, 1, 3);
  i := StrToInt(Number);
  i := i * 2;
  FileName := 'a' + IntToStr(i) + WideCopy(FileName, 4, Length(FileName) - 3);

This was followed by removing the prefix ('a') and appropriately zero-padding some of the filenames.

Does any one know of a simpler/easier way?  I also looked at Thunar's renaming feature and Metamorphose without coming up with anything useful.

ReNamer can do it without using PascalScript:

You might want to strip the numbers first, though:

If you want to make it even more simpler, i.e. without using ReNamer or any other additional program (it's even easier with xplorer² mass rename), beats me.

Thanks!  The initial stripping seems to help quite a bit :)


[0] Message Index

Go to full version