#1 2022-11-16 16:26

roosterdog22
Member
Registered: 2022-11-16
Posts: 4

Serialize Question

I have a 250 thousand images I'm trying to rename in a certain way but I can't seem to achieve it.

This is what I'm going for:

Set#|Shoot#|Image#

001_001_001.jpg
001_001_002.jpg
001_001_003.jpg
001_002_001.jpg
001_002_002.jpg
001_002_003.jpg
001_003_001.jpg
001_003_002.jpg
001_003_003.jpg
002_001_001.jpg
002_001_002.jpg
002_001_003.jpg
002_002_001.jpg
002_002_002.jpg
002_002_003.jpg
002_003_001.jpg
002_003_002.jpg
002_003_003.jpg
003_001_001.jpg
003_001_002.jpg
003_001_003.jpg
003_002_001.jpg
003_002_002.jpg
003_002_003.jpg
003_003_001.jpg
003_003_002.jpg
003_003_003.jpg

I'm obviously not trying to do all of them at once but rather set by set and what's stopping me is the shoot number repeating all the way to the end and not incrementing by 1 at the change of the shoot folder.

Offline

#2 2022-11-16 17:13

jogiwer
Member
From: Germany
Registered: 2022-11-05
Posts: 28

Re: Serialize Question

Hi roosterdog22,

here are some essential details missing.

Do you want to do the sequencing without inspecting filename and folders? Or do some or all numbers exist inside the path of the files?

Offline

#3 2022-11-17 00:26

roosterdog22
Member
Registered: 2022-11-16
Posts: 4

Re: Serialize Question

jogiwer wrote:

Hi roosterdog22,

here are some essential details missing.

Do you want to do the sequencing without inspecting filename and folders? Or do some or all numbers exist inside the path of the files?

They are all serialized.

I just want to make it easier for me to identify where I pulled a file from when I use it in a project and to also avoid any naming conflicts.

Thanks for asking.

Offline

#4 2022-11-19 18:59

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

Re: Serialize Question

roosterdog22 wrote:

I have a 250 thousand images I'm trying to rename in a certain way but I can't seem to achieve it.

Can you provide some examples of input and desired output filenames?

Offline

#5 2022-11-19 20:01

roosterdog22
Member
Registered: 2022-11-16
Posts: 4

Re: Serialize Question

den4b wrote:
roosterdog22 wrote:

I have a 250 thousand images I'm trying to rename in a certain way but I can't seem to achieve it.

Can you provide some examples of input and desired output filenames?

XbIt1Dm.png

The screenshot is an example of what I'm trying to achieve however if I were to add multiple folders with varying amounts of images then it doesn't work.

What I need it to do (the 4th rule which is highlighted) is repeat to the end and then increment by 1 after the folder changes and there doesn't appear to be an option for that?

An example of the folder structure:

Set_001
	Shoot_001
		001.jpg
		002.jpg
		003.jpg
	Shoot_002
		001.jpg
		002.jpg
		003.jpg
	Shoot_003
		001.jpg
		002.jpg
		003.jpg
Set_002
	Shoot_001
		001.jpg
		002.jpg
		003.jpg
	Shoot_002
		001.jpg
		002.jpg
		003.jpg
	Shoot_003
		001.jpg
		002.jpg
		003.jpg
Set_003
	Shoot_001
		001.jpg
		002.jpg
		003.jpg
	Shoot_002
		001.jpg
		002.jpg
		003.jpg
	Shoot_003
		001.jpg
		002.jpg
		003.jpg

Each shoot can range anywhere from 50-100 images.

Last edited by roosterdog22 (2022-11-19 22:50)

Offline

#6 2022-11-20 19:15

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

Re: Serialize Question

It will be a lot simpler to insert parent folder names into the file names.

For example, converting "Set_001\Shoot_002\003.jpg" to "Set_001\Shoot_002\Set_001_Shoot_002_003.jpg".

Then you can delete the unnecessary parts like "Set_" and "Shoot_" to leave you with just "Set_001\Shoot_002\001_002_003.jpg".

A pascal script attached below will insert the two parent folder names:

var
  ParentFolder1, ParentFolder2: WideString;
begin
  ParentFolder1 := WideExtractFileDir(FilePath);
  ParentFolder2 := WideExtractFileDir(ParentFolder1);
  ParentFolder1 := WideExtractFileName(ParentFolder1);
  ParentFolder2 := WideExtractFileName(ParentFolder2);
  FileName := ParentFolder2 + '_' + ParentFolder1 + '_' + FileName;
end.

Offline

#7 2022-11-20 20:30

roosterdog22
Member
Registered: 2022-11-16
Posts: 4

Re: Serialize Question

Amazing...

Thank you so much for this!

Offline

Board footer

Powered by FluxBB