You are not logged in.
Pages: 1
I do a lot of photography whereby I have to rename all of my files renamer has been fantastic for this and I use it daily. I currently have the programme serializing my files en mass for example dscn0001, dscn002,dsnc003, dscn004 changes to lb001, lb002,lb003,lb004 and so on. At the end of renaming I manually change the serialized number to the next one ie lb005, then save the statement so when I next use renamer it is automatically set for lb005. Is there a way that the next number can automatically be there when I open the programme or do I have to manually do it each time. It is not a problem but occasionally I forget to do it which can cause problems for the next batch of numbers. In anticipation, thank you.
Offline
If the new name of your images always inherits the index from the old name, then it would be easier to just keep the old index and just change the prefix. For example, dscn0001 to lb001 - replacing only the highlighted part, which won't require renumbering.
Unfortunately, there is no way to automatically remember the last used index and carry it over for the next use. There might be a possibility of creating batch scripts which could automatically adjust the index stored in the preset file, before the preset is loaded into ReNamer, but then the script will somehow need to know what to adjust it to.
Offline
There is an easy solution if the numbers are different but have the a more less static offset, for example dscn9247 to lb3074, dscn9248 to lb3075, etc - where a constant offset of 6173 is used between the numbers. A simple pascal script can parse the index in the filename, subtract a static offset and produce the target index. In this way you only really need to adjust the offset if you get gaps in the image. sets.
Offline
One way I've thought about it:
- Have all the files in the same folder (Old with "lb0..." and the ones to rename, "dscn").
- Set all the rules so the serialize one is the last one.
On the last rule a pascal script that:
- Gets all Files in a Folder
- In a loop across the files find the highest number matching the name
- Keep counting from that till the end...
Well... As i was thinking I end up doing it, so here it is, give it a shot:
var
Files: TStringsArray;
RefName, Name, Difference, Number: WideString;
I, Current, Highest, Counter: Integer;
Initialized: Boolean;
begin
// Initialize. This part will only be executed the first time.
if not Initialized then
begin
Initialized := True;
// Scan for files in the folder and initialize some vars.
WideScanDirForFiles(WideExtractFilePath(FilePath), Files, False, False, False, '*');
RefName := WideExtractBaseName(FileName);
Highest := 0;
// Loop through all the files to find the highest value.
for I:=0 to length(Files)-1 do
begin
Name := WideExtractBaseName(Files[i]);
// Check that the reference is contained in the compared name
if (WideTextPos(RefName, Name) = 1) then
begin
// Extract the difference. This will usually be number but not always.
Difference := WideCopy(Name, length(RefName)+1, length(Name));
// Convert the difference into an integer, if possible, else return 0.
Current := StrToIntDef(Difference, 0);
// Update the highest value
if (Current > Highest) then Highest := Current;
end;
end;
// Set the value of the counter. It will start from here.
Counter := Highest;
end;
// Increment counter and pad with zeros.
Counter := Counter + 1;
Number := IntToStr(Counter);
while length(Number)<4 do Number := '0' + Number;
// Output the serialized name.
// To add spaces better be added with insert as suffix before this script,
// So that the search above is consistent.
FileName := WideStripExtension(FileName) + Number + WideExtractFileExt(FileName);
end.
Also if someone has any opinion, I'm listening.
If this software has helped you, consider getting your pro version. :)
Offline
Nice idea SafetyCar!
I'm not sure about the purpose of the "RefName" variable. Would it not be easier to extract the index by simply stripping out non-numeric characters?
Also, a derviation of your idea: You can dedicate a static file for storing a list of (or some necessary information about) previously seen files and/or their new names, and use it a s a lookup. I haven't given it much thinking but it might work out well.
Offline
I'm not sure about the purpose of the "RefName" variable. Would it not be easier to extract the index by simply stripping out non-numeric characters?
Maybe it's because I tend to think complicate things, but the purpose of the comparisons is to match exactly the name you are targeting because in a some mor general situation you might have others similar names, and I wouldn't want messed files like DSCN01 with others as DSCNEH32.
Also, a derviation of your idea: You can dedicate a static file for storing a list of (or some necessary information about) previously seen files and/or their new names, and use it a s a lookup. I haven't given it much thinking but it might work out well.
In fact that sounds like a good idea for this case, but for a more general one the script above is more flexible.
If this software has helped you, consider getting your pro version. :)
Offline
If the user more than one cameras, each will have its own series, and they have to be treated separately.
(it would be best if he does not mix them all in one folder, though...)
Offline
Pages: 1