You are not logged in.
Pages: 1
Hi,
I have a vast photo collection that I would like to rename into the following format YYYY-MM-DD-xxx where xxx is a serialized number that resets on change of photograph date.
DSCN1001.JPG => 2010-11-20-001.JPG
DSCN1002.JPG => 2010-11-20-002.JPG
DSCN1003.JPG => 2010-11-20-003.JPG
DSCN1004.JPG => 2010-11-21-001.JPG
DSCN1005.JPG => 2010-11-22-001.JPG
DSCN1006.JPG => 2010-11-22-002.JPG
I can achieve most of what I want with standard Delete, Insert and Serialize rules, but only with files from the same date. I suspect a Script is required to reset the serialize number and that is where some help would be gratefully received as programming is not one of my strengths.
Many Thanks in advance.
Offline
Hi mf, welcome to the community.
@Denis: maybe you want to think about adding this feature to the gui: "Serialize > [ ]Reset if file name change" ?
mf, you may try the following script with copies of your real files first.
I have tested this with an few test files only:
First add rules to get your wanted file name, but without the serialized counter:
For example my test names:
1) Delete: Delete last sign
FROM: TO:
2010-11-20-a 2010-11-20-
2010-11-20-b 2010-11-20-
2010-11-20-c 2010-11-20-
2010-11-20-d 2010-11-20-
2010-11-21-a 2010-11-21-
2010-11-21-b 2010-11-21-
2010-11-22-a 2010-11-22-
2010-11-22-b 2010-11-22-
2010-11-22-c 2010-11-22-
Warning: found 6 invalid file names!
But this warning doesn't matter since we gonna add an script to add serialize number which reset if file name change:
(Read our wiki how to use an script >> http://www.den4b.com/wiki/ReNamer:Rules:PascalScript )
//Add serialize number but reset counter if file name change
var
CurrOrgFileName, LastOrgFileName, SerialString, LastOrgFileNameStorage: WideString;
SerialNumber: Integer;
begin
LastOrgFileName := LastOrgFileNameStorage;
CurrOrgFileName := WideExtractFileName(FileName);
LastOrgFileNameStorage := CurrOrgFileName;
//
//If FileName still the same then
//increase SerialNumber, else reset to 1:
If (CurrOrgFileName = LastOrgFileName) Then
SerialNumber := SerialNumber+1
else
SerialNumber := 1;
//
//Pad SerialNumber to wanted length:
SerialString := IntToStr(SerialNumber);
While (Length(SerialString) < 3) Do
SerialString := '0'+ SerialString;
//
FileName := CurrOrgFileName + SerialString
+ WideExtractFileExt(FileName);
end.
Result of this script:
FROM: TO:
2010-11-20-a 2010-11-20-001
2010-11-20-b 2010-11-20-002
2010-11-20-c 2010-11-20-003
2010-11-20-d 2010-11-20-004
2010-11-21-a 2010-11-21-001
2010-11-21-b 2010-11-21-002
2010-11-22-a 2010-11-22-001
2010-11-22-b 2010-11-22-002
2010-11-22-c 2010-11-22-003
HTH?
If yes, spread the word about ReNamer, help two others too and read my signature ;-)
Last edited by Stefan (2010-11-22 12:37)
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.
I shall try this out tonight.
Offline
@Denis: maybe you want to think about adding this feature to the gui: "Serialize > [ ]Reset if file name change" ?
this feature is the reason why i registered here would be so nice to have it!
Offline
Option "Reset if file name changes" has been added to the Serialize rule in ReNamer v6.7.0.1 Beta.
Offline
Option "Reset if file name changes" has been added to the Serialize rule in ReNamer v6.7.0.1 Beta.
Works perfect, many thanks for building in.
Q: Keep first part of name, and then serialize same named files afterwards:
FROM:
220339 page1.jpg
220339 page2.jpg
220339 flip.jpg
220339 smtg.jpg
220339 smtg.jpg
220339 - smtg.jpg
220339 smtg2.jpg
220339 test it.jpg
666110 page1.jpg
666110 smtg.jpg
666110 - smtg.jpg
666110 test it.jpg
789123 page2.jpg
789123 case.jpg
888999 page1.jpg
888999 smtg2.jpg
TO:
220339 01.jpg
220339 02.jpg
220339 03.jpg
220339 04.jpg
220339 05.jpg
220339 06.jpg
220339 07.jpg
666110 01.jpg
666110 02.jpg
666110 03.jpg
666110 04.jpg
789123 01.jpg
789123 02.jpg
888999 01.jpg
888999 02.jpg
A: USE:
1) Delete: Delete from Position 8 until the End (skip extension)
2) Serialize: Incremental from 1 step 1 repeat 1 (reset index if file name changes) and pad to length 2 as Suffix (skip extension)
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
Pages: 1