You are not logged in.
How could I automatically except from renaming the files already being renamed?
file 1.ext
file 2.ext
file 3.ext
are existing and renamed.
Theses files are added to the same folder the files above are stored in:
file xyz.ext
file ffg.ext
file wer.ext
They shall be renamed to
file 4.ext
file 5.ext
file 6.ext
After adding the folder containing these files to ReNamer, how could I automatically start the enumeration with 4, instead of renaming all of the files in the folder with the same method?
Offline
It is best to move the renamed files to a new folder (or a subfolder of the source folder).
This is easy to do, by including the folder's name in the new name.
For example, enter the name as: NewFolderName\NewNamePattern
Thus only the files to be renamed will be left behind.
Offline
- or just select the new files only to import
- or remove old numbering in first rule, then serialize all file again in second rule
A little work is involved always.
If you want to do it automatically you have to learn PascalScript, basically it's
For Each File
vTest = regexmatch( BaseName, "(.+? )(\d+)" )
if(vTest > 0)
LastNumber = $2 //Trailing number found and stored, overwriting last stored
Else
//No more trailing number found, so add (last found number +1) to this file name
Number = LastNumber + 1//increase last number by 1
FileName := BaseName + Number + Extension
LastNumber = Number //store for next iteration
Next
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
Thank you, narayan.
<<<It is best to move the renamed files to a new folder (or a subfolder of the source folder).
And after renaming back to the old folder. Yes, you could order the files by date (all left in the same foler), but only, if they are all newer ones, the new ones would be easily accessible e.g. at the top of all of the files
<<<<For example, enter the name as: NewFolderName\NewNamePattern
<<<Thus only the files to be renamed will be left behind.
Yes, but that way I would have to manually set the starting number for enumeration, if I am right. And if it were more groups to rename, I would have do it with each single group again.
Thanks Stefan.
<<<- or just select the new files only to import
Would be the same "problem", I would have set the starting number for enumerating.
<<<- or remove old numbering in first rule, then serialize all file again in second rule
That would be very easyly done, but mix up the files and make it impossible to access the right file anymore.
<<<<For Each File
vTest = regexmatch( BaseName, "(.+? )(\d+)" )
if(vTest > 0)
LastNumber = $2 //Trailing number found and stored, overwriting last stored
Else
//No more trailing number found, so add (last found number +1) to this file name
Number = LastNumber + 1//increase last number by 1
FileName := BaseName + Number + Extension
LastNumber = Number //store for next iteration
Next
Thank you, so that is the beginning to start with...
<<<<If you want to do it automatically you have to learn PascalScript, basically it's
OK, a bit of Pascal, so after some months of learning, I could let do it automatically.
Offline
Ah, but when you have all the renamed files in another folder, there is not much work left.
All you have to do is to sort the renamed files' folder on "Name" column (sorting on date will give you unreliable results).
The last file will always have the largest number.
So your next renaming will continue from there.
*****
Your original post does not mention the need to rename multiple groups.
If you have multiple groups, each having its own serial numbers, the method suggested above is the least complicated.
Just use a separate destination folder for each group.
Last edited by narayan (2013-04-09 03:40)
Offline
<<<Ah, but when you have all the renamed files in another folder, there is not much work left.
Yes, may be when you do this renaming repeatedly over some time, it might be become a bit unconvinient. And I would have to set the starting enumerating number in ReNamer, if I see it right.
<<<<All you have to do is to sort the renamed files' folder on "Name" column (sorting on date will give you unreliable results).
Since the files to be renamed are add a folder anyway, I could move them to a another folder anyway, respectively rename them in their origingal folder you call call "Download" folder.
<<<<So your next renaming will continue from there.
Yes, but I would have to set the starting enumeration number, I assume, and so some actions manually before renaming.
<<<Your original post does not mention the need to rename multiple groups.
Yes, because I thought, that wouldn't effect the method.
<<<<If you have multiple groups, each having its own serial numbers, the method suggested above is the least complicated.
Just use a separate destination folder for each group.
So I would have to do some more actions, set the different starting numbers etc.
OK, I will try it, many thanks.
Offline
How could I automatically except from renaming the files already being renamed?
file 1.ext
file 2.ext
file 3.extare existing and renamed.
Theses files are added to the same folder the files above are stored in:
file xyz.ext
file ffg.ext
file wer.extThey shall be renamed to
file 4.ext
file 5.ext
file 6.extAfter adding the folder containing these files to ReNamer, how could I automatically start the enumeration with 4,
instead of renaming all of the files in the folder with the same method?
FROM:
file 01.ext
file 02.ext
file 03.ext
file ffg.ext
file wer.ext
file xyz.ext
TO:
file 01.ext
file 02.ext
file 03.ext
file 04.ext
file 05.ext
file 06.ext
USE:
PascalScript
See our wiki for an how-to using PascalScript rule >> http://www.den4b.com/wiki/ReNamer:Rules:PascalScript
NOTE: this script works for your provided file name examples only due the used RegEx pattern.
file 03.ext - '^(.*?\s)(\d+)$'
file ffg.ext - '^(.*?\s)(.+)$',
var
BaseName,FileExte,LastNumber,Serial:WideString;
Parts: TstringsArray;
Math,PadLen:Integer;
begin
BaseName := WideExtractBaseName(FileName);
FileExte := WideExtractFileExt(FileName);
//RegEx for "file 03.ext"
Parts := SubMatchesRegEx(BaseName, '^(.*?\s)(\d+)$', False);
if Length(Parts) = 2 then
begin
LastNumber := Parts[1]
PadLen := Length(LastNumber)
end
else
begin
//RegEx for "file ffg.ext"
Parts := SubMatchesRegEx(BaseName, '^(.*?\s)(.+)$', False);
if Length(Parts) <> 2 then Exit;
Math := StrToInt(LastNumber) + 1;
Serial := IntToStr(Math);
While (Length(Serial) < PadLen) Do Serial := '0'+Serial;
FileName := Parts[0] + Serial + FileExte;
LastNumber := Serial;
end;
end.
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
Thank you very much, Stefan,
It works perfectly. Great.
Many thanks.
Offline
I assume, with these kind of file names here - http://www.den4b.com/forum/viewtopic.php?id=1792 - you cannot use such a method.
Offline
I assume, with these kind of file names here - http://www.den4b.com/forum/viewtopic.php?id=1792 - you cannot use such a method.
Why not? You just have to find an common pattern in English words to match all file names and then adjust the regex expression accordingly.
If you can provide the pattern and three/five before and after examples one may be able to help you on creating the regex.
.
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