topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 4:27 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: File Renaming: Renumbering by Calculation (e.g. even, odd)?  (Read 5096 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
File Renaming: Renumbering by Calculation (e.g. even, odd)?
« on: September 01, 2011, 06:53 AM »
Tried to figure out a simple way to renumber files of the form:

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

as:

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

or:

  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;
begin
  Number := Copy(FileName, 1, 3);
  i := StrToInt(Number);
  i := i * 2;
  FileName := 'a' + IntToStr(i) + WideCopy(FileName, 4, Length(FileName) - 3);
end.

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.

Lashiec

  • Member
  • Joined in 2006
  • **
  • Posts: 2,374
    • View Profile
    • Donate to Member
Re: File Renaming: Renumbering by Calculation (e.g. even, odd)?
« Reply #1 on: September 01, 2011, 07:18 AM »
ReNamer can do it without using PascalScript:

2011-09-01 14 15 55.png

You might want to strip the numbers first, though:

2011-09-01 14 18 41.png

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.
« Last Edit: September 01, 2011, 07:24 AM by Lashiec »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: File Renaming: Renumbering by Calculation (e.g. even, odd)?
« Reply #2 on: September 01, 2011, 07:24 AM »
Thanks!  The initial stripping seems to help quite a bit :)