"Same" file names..

All your suggestions, requests and ideas for future development
Post Reply
tfonias74
Donor
Posts: 47
Joined: 16 Jul 2013, 09:17

"Same" file names..

Post by tfonias74 »

Hi code Master :geek: ,

How can I make the rename process to assign (1)..(x) at the end of similar items (a number of jpg files accompanying the movie)??
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "Same" file names..

Post by rednoah »

Not sure, I've never tested that case.

You have two options:

Grab numbers from the filename:

Code: Select all

{fn.matchAll(/\d+/).last()}
Use duplicate index:

Code: Select all

{di}
The first one works by grabbing the info from the filename, but you might wanna limit that to ext =~ jpg|png and maybe limit to the end of the filename since you might get bad matches otherwise.

The second is the number of the the identical object got matched. If it's sorted, and all renamed in a batch, then the movie will come first, evaluate to 0 and fail, while the rest will be 1, 2, 3...
:idea: Please read the FAQ and How to Request Help.
tfonias74
Donor
Posts: 47
Joined: 16 Jul 2013, 09:17

Re: "Same" file names..

Post by tfonias74 »

Could you give me a quick guide on how to match with the ext? "limit that to ext =~ jpg|png and maybe limit to the end of the filename" (I tried some stuff but I cannot make it work..)

Thanx in advance!
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "Same" file names..

Post by rednoah »

Code: Select all

{if (ext =~ /jpg|png/) fn.match(/\d+$/)}
if (ext matches jpg or png) then match (number sequence ending with input terminator) from filename
:idea: Please read the FAQ and How to Request Help.
tfonias74
Donor
Posts: 47
Joined: 16 Jul 2013, 09:17

Re: "Same" file names..

Post by tfonias74 »

Thanx man, I'm not that familiar with java and trying to figure out what does what..
Post Reply