You are not logged in.
Pages: 1
Hello there i was wondering if you could help me as i know nothing about Pascal.
i would liek to know if there was a way to remane my comics and manga to remove all the crap from them
the structure i would need to navigate is Title - Volume - Chapter - page number
where title, Volume and chapter are all directories and sub-directories and pagenumber is the file
any help would be great
Omni
Offline
The code below should do the trick!
const
DELIMITER = ' - ';
var
Count: Integer;
Parts: TStringsArray;
begin
Parts := WideSplitString(FilePath, '\');
Count := Length(Parts);
if Count >= 5 then
FileName :=
Parts[Count-4] + DELIMITER +
Parts[Count-3] + DELIMITER +
Parts[Count-2] + DELIMITER +
FileName;
end.
Offline
Thank you very much
is there away to do it so it looks like Title - V%n - C%n - pagenumber
where %n is the number but is generated by the number of folers that it has had to have been navigated with a seperate count for each type
Offline
is there away to do it so it looks like Title - V%n - C%n - pagenumber,
where %n is the number but is generated by the number of folers that it has had to have been navigated with a seperate count for each type
??????????? Example maybe??
Offline
say the folder structure was Bleach-> Bleach Volume 1-> Chapter1[M7]-> Bleach-01.jpeg
i would like the file name to become Bleach-V001-C001-01.jpeg
but there are currently 26 volumes and a varying number of chapters per volume and a varying number of pages per chapter
and i am trying to compile them in to a CBR(comic book Rar) for archiving and they all have different naming conventions
Offline
I cannot write a script for you, unless you describe the algorithm behind the rule that you want to create. Your explanation is very vague, can you please be more specific? For example: for "Bleach\Bleach Volume 1\Chapter1[M7]\Bleach-01.jpeg" you want "Bleach-V001-C001-01.jpeg". We get the name of first folder, then V and the first number out the folder, then C and the first number out of the folder, then just the first number of the filename?
Offline
yep got it in one sorry about the poor explination
Offline
Here you go, it will do exactly as described in my previous post (plus it will pad all numbers to 3 digits). You can change the padding length and the delimiter by modifying the constants at the top of the script. The new code will produce "Bleach - V001 - C001 - 001.jpeg" for your example.
By the way, sorry for being so harsh. I was just dealing with recent popularity of my forum for SPAM-BOTS. I have integrated an image verification code in the registration page. This should slow down those bastards!
const
DELIMITER = ' - ';
PADDING_N = 3;
var
Count: Integer;
Parts: TStringsArray;
function ExtractFirstNumber(const S: WideString): string;
var
I: Integer;
IsDigit: Boolean;
Started: Boolean;
begin
Result := '';
Started := False;
for I:=1 to Length(S) do
begin
IsDigit := IsWideCharDigit(S[i]);
if not Started and IsDigit then Started := True;
if Started and IsDigit then Result := Result + S[i];
if Started and not IsDigit then Break;
end;
end;
function PadStr(const S: string; NewLength: Integer): string;
begin
Result := S;
while Length(Result) < NewLength do
Result := '0'+Result;
end;
begin
Parts := WideSplitString(FilePath, '\');
Count := Length(Parts);
if Count >= 5 then
FileName :=
Parts[Count-4] + DELIMITER +
'V' + PadStr(ExtractFirstNumber(Parts[Count-3]), PADDING_N) + DELIMITER +
'C' + PadStr(ExtractFirstNumber(Parts[Count-2]), PADDING_N) + DELIMITER +
PadStr(ExtractFirstNumber(FileName), PADDING_N) +
WideExtractFileExt(FileName);
end.
Tell me how it goes, ok?
Offline
yeah i did notice 3-4 of them pop up earlier and its no worries i know how hard it can be to run forums
Offline
Pages: 1