#1 2018-12-31 09:43

Bluebear
Member
Registered: 2018-12-31
Posts: 5

Feature Request: Serialize Increment on folder change

I would like to suggest/request an extra check box in the Serialize configuration that would enable increment only when a new folder is encountered such that in folder1 -> prefix00, folder2 -> prefix01.... etc

Thank you so much for all the work on such a useful tool!  smile

Offline

#2 2019-01-02 11:09

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Feature Request: Serialize Increment on folder change

Hi Bluebear, welcome and thank you for your support.


Doesn't "Reset if folder changes" already works for you? See http://www.den4b.com/wiki/ReNamer:Rules:Serialize

If not, please explain with more details. (me guess the word "only" is a main part of your request?)


ReNamer 3.00  (2 April 2006)
* Added option to Incremental Serialization,  to reset Index when folder changes;

 


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

#3 2019-01-02 23:49

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Feature Request: Serialize Increment on folder change

Stefan wrote:

Doesn't "Reset if folder changes" already work for you?

I believe the poster wants a different behaviour.

Instead of resetting the index when the folder changes, the poster wants to increment the index ONLY when the folder changes.

For example, the "Reset if folder changes" option would achieve:

A\A.txt -> A\A1.txt
A\B.txt -> A\B2.txt
A\C.txt -> A\C3.txt
B\A.txt -> B\A1.txt
B\B.txt -> B\B2.txt
B\C.txt -> B\C3.txt

While the "Increment only when folder changes" option would achieve:

A\A.txt -> A\A1.txt
A\B.txt -> A\B1.txt
A\C.txt -> A\C1.txt
B\A.txt -> B\A2.txt
B\B.txt -> B\B2.txt
B\C.txt -> B\C2.txt

Perhaps, Bluebear could confirm or clarify?

Offline

#4 2019-01-04 04:56

Bluebear
Member
Registered: 2018-12-31
Posts: 5

Re: Feature Request: Serialize Increment on folder change

Thank you so much for your prompt replies Stefan and Den4b.

Den4b is correct in this assumption, my apologies for lack of clarity smile

Kind Regards

Offline

#5 2019-01-04 05:17

Bluebear
Member
Registered: 2018-12-31
Posts: 5

Re: Feature Request: Serialize Increment on folder change

Just as a follow up if the feature is to be considered:

perhaps a dropdown menu or radio button may be more appropriate as these two conditions are exclusive such that choices may be

default Null
           Reset if folder changes
           Increment only when folder changes

Offline

#6 2019-01-04 11:51

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Feature Request: Serialize Increment on folder change

Thanks for clarifying.

But...

The whole Serialize-Rule works on files. (for each file)
You want to work on folders (for each folder add the same digit to the files)
Me guess that is hard to fit (clearly) into that rule dialog.

How often would you need that?
Wouldn't be an PascalScript work for you too? Just asking...



 


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

#7 2019-01-04 18:32

Bluebear
Member
Registered: 2018-12-31
Posts: 5

Re: Feature Request: Serialize Increment on folder change

Thank you Stefan,

I hadn't really considered learning pascal currently, and my suggestion was based as an alternative to the existing 'Reset if folder changes' rule. Another check box would suffice, noting the aforementioned would need to be deselected.

I use Renamer at home quite regularly and like it's simplicity immensely and thought others may benefit from the suggestion. I understand some may find limited use, however I certainly rename files separately-per-folder as discussed often enough to join my first forum specifically for this reason.

Offline

#8 2019-01-04 21:42

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Feature Request: Serialize Increment on folder change

smile  I don't meant you should script that on your own big_smile

For example...


TESTING

FROM:
\Tests\For Each Folder Do\Folder1\FileA.txt
\Tests\For Each Folder Do\Folder1\FileB.txt
\Tests\For Each Folder Do\Folder1\FileC.txt
\Tests\For Each Folder Do\Folder1\FileD.txt

\Tests\For Each Folder Do\Folder2\FileA.txt
\Tests\For Each Folder Do\Folder2\FileB.txt
\Tests\For Each Folder Do\Folder2\FileC.txt
\Tests\For Each Folder Do\Folder2\FileD.txt

TO:
\Tests\For Each Folder Do\Folder1\FileA 001.txt
\Tests\For Each Folder Do\Folder1\FileB 001.txt
\Tests\For Each Folder Do\Folder1\FileC 001.txt
\Tests\For Each Folder Do\Folder1\FileD 001.txt

\Tests\For Each Folder Do\Folder2\FileA 002.txt
\Tests\For Each Folder Do\Folder2\FileB 002.txt
\Tests\For Each Folder Do\Folder2\FileC 002.txt
\Tests\For Each Folder Do\Folder2\FileD 002.txt



Use a PascalScript Rule:
http://www.den4b.com/wiki/ReNamer:Rules:PascalScript


Problem is, we have no really control at how the folders are added and sorted, and so which number is added to which folder.
(Or I didn't have the right idea)
You may want to add a column "Path" and sort by folder name before apply this script. Next use Preview! And have a Backup.


A PascalScript for you:

// PascalScript for den4b ReNamer  , 04.Jan.2019
// http://www.den4b.com/forum/viewtopic.php?pid=10672#p10672
// For each Folder add the same digit to all files, increase digit if Folder changes.
// You may add column "Path" and sort by Folder name first, then Preview before renaming.
var
  SerialNumber: Integer;
  CurrentFldName, LastFldName, SerialString: WideString;

begin
  CurrentFldName:= WideExtractFileDir(FilePath);

   If (CurrentFldName <> LastFldName) Then
      SerialNumber := SerialNumber +1;

  //Pad SerialNumber to wanted length:
  SerialString := IntToStr(SerialNumber);
  While (Length(SerialString) < 3) Do
          SerialString := '0'+ SerialString;


  FileName := WideExtractBaseName(FileName)
  + ' ' + SerialString
  + WideExtractFileExt(FileName);

    LastFldName := CurrentFldName;
end.



You can also use this below for digits without padding:
  FileName := WideExtractBaseName(FileName)
  + ' ' + IntToStr(SerialNumber)
  + WideExtractFileExt(FileName);

\Tests\For Each Folder Do\Folder1\FileA 1.txt
\Tests\For Each Folder Do\Folder1\FileB 1.txt

\Tests\For Each Folder Do\Folder2\FileA 2.txt
\Tests\For Each Folder Do\Folder2\FileB 2.txt


Also you can rearrange the order for the New Name:
  FileName := 'Prefix'+IntToStr(SerialNumber) + '_' + FileName;
\Tests\For Each Folder Do\Folder1\Prefix1_FileA.txt
\Tests\For Each Folder Do\Folder1\Prefix1_FileB.txt

\Tests\For Each Folder Do\Folder2\Prefix2_FileA.txt
\Tests\For Each Folder Do\Folder2\Prefix2_FileB.txt



HTH until den4b will add something as you had suggested.


 


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

#9 2019-01-06 02:27

Bluebear
Member
Registered: 2018-12-31
Posts: 5

Re: Feature Request: Serialize Increment on folder change

Thank you so much Stefan, and my apologies (again!) for the misunderstanding

The script works perfectly which I modified slightly for the desired outcome as follows:

// PascalScript for den4b ReNamer  , 04.Jan.2019
// [url]http://www.den4b.com/forum/viewtopic.php?pid=10672#p10672[/url]
// For each Folder add the same digit to all files, increase digit if Folder changes.
// You may add column "Path" and sort by Folder name first, then Preview before renaming.
var
  SerialNumber: Integer;
  CurrentFldName, LastFldName, SerialString: WideString;

begin
  CurrentFldName:= WideExtractFileDir(FilePath);

   If (CurrentFldName <> LastFldName) Then
      SerialNumber := SerialNumber +1;

  //Pad SerialNumber to wanted length:
  SerialString := IntToStr(SerialNumber);
  While (Length(SerialString) < 2) Do
          SerialString := '0'+ SerialString;

  FileName := SerialString
  + WideExtractBaseName(FileName)
  + WideExtractFileExt(FileName);

    LastFldName := CurrentFldName;
end.   

https://www.den4b.com/forum/img/members … screen.jpg


Hopefully I have posted this correctly and I look forward to this implementation in a future version.

Kind Regards!

Offline

Board footer

Powered by FluxBB