You are not logged in.
Pages: 1
If you have files such as the list below, how can you rename them to all have 3 digit issue numbers?
Comic Name 1.cbr
Some Really Amazing Comic Name 002.cbz
Comic 08.cbz
TIA,
KF
Offline
Hi king,
at least you could do this with two regular expression search & replace:
For Comic Name 1.cbr
Search for
space => \s
on single digit => \d => in brackets () for back referencing (\d)
end of name => $ ........ to capture only the last digit in name like "test 2king 3 fenix 4.txt"
[x] Skip extension
Search: \s(\d)$
Replace with
space
two zero's => 00
the captured digit => $1
Replace: 00$1
---
For Comic 08.cbz
Search: \s(\d\d)$
Replace: 0$1
---
HTH?
Stefan
Last edited by Stefan (2007-10-25 21:31)
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
You can use a predefined script from within PascalScript rule, which is called "Pad number sequences".
It does exactly what you need! To change the length of the new numbers - change PAD_TO_LENGTH constant.
Offline
Can you provide a example of the pascalscript to do so, I am afraid I dont know it very well
KF
Offline
DOH, sorry I understand now
KF
Offline
That script comes together with the distributive of ReNamer
Just in case, I post the full script which I have mentioned:
const
PAD_TO_LENGTH = 3;
function CountDigits(const S: WideString; StartI: Integer): Integer;
var I: Integer;
begin
Result := 0;
for I:=StartI to WideLength(S) do
if IsWideCharDigit(S[i])
then Inc(Result)
else Break;
end;
function MakeZeros(Count: Integer): WideString;
var I: Integer;
begin
Result := '';
for I:=1 to Count do
Result := Result + '0';
end;
var
Start, Count: Integer;
begin
Start := 1;
while Start < WideLength(FileName) do
begin
Count := CountDigits(FileName, Start);
if (Count > 0) then
if (Count < PAD_TO_LENGTH) then
begin
WideInsert(MakeZeros(PAD_TO_LENGTH-Count), FileName, Start);
Start := Start + PAD_TO_LENGTH;
end
else Start := Start + Count
else Inc(Start);
end;
end.
Offline
Pages: 1