Page 1 of 1

Can I set a max characters limit to the filenames?

Posted: 16 Jul 2020, 23:09
by Grubbyhoug
EPF is such a program masterpiece, but when you come across those sites where the filenames are too long for my taste and yet I want to keep the original names, at least partially, is there a way to cut them short? I am talking for instance when images are named with a lot of tags which makes them more than often ridiculously lengthy, yet if they contain the image ID I don't want to loose that (with e.g. creating numerical file names 001, 002, 003...).
E.g. Site_Name 6317 tag tag tag tag tag tag tag tag tag tag tag tag tag tag.jpg I want to be cut down simply to:
Site_Name 6317.jpg (6317 is the ID number in this case)
Let's say site is named abc.net,
I want to set a max characters limit to 12: abc.net 6317.jpg (which would essentially work from 1-9999)
Is there a cmd in properties/naming/advanced -or- /expert I can use to make this work?

keep it up!

Re: Can I set a max characters limit to the filenames?

Posted: 17 Jul 2020, 12:09
by Maxim
In [ Naming - Expert ] you can use Regular Expressions to generate file names. If your file names look like this:

abc.net 6317 tag tag tag tag tag tag tag.jpg

then the Expression should be:

(abc\.net\s\d+)

and the Result is:

[#1]

Image

Re: Can I set a max characters limit to the filenames?

Posted: 18 Jul 2020, 18:39
by Grubbyhoug
This did not work for me, sorry I should've given you a real example, maybe the expression would be different? (Of course I changed the site name.)
A real file:
Konachan.com - 311053 2girls breast_grab drink hakurei_reimu izayoi_sakuya japanese_clothes miko moneti_(daifuku) sake touhou yuri.jpg
My goal after download:
Konachan.com - 311053.jpg
Image Link to test it out if need be.

Also, what does \s and \d+ mean in the expression?

Indeed, this is in realms of expertise but that's okay once it is set up. However, it would truly aid to have a setting within the program that prohibits longer filenames after you define the limit. In this case that limit would be 21. For newcomers to this program and average users would find this much more manageable, and it's quick to set up/change! Perhaps even an implemented reverse option (tickbox) that would "crop out" the beginning instead; so if I would've set the limit to 4 then the result would've been yuri.jpg (don't know how useful that would be but if it's easy enough to implement, why not?).
Something to consider adding in a future release?

Re: Can I set a max characters limit to the filenames?

Posted: 19 Jul 2020, 13:45
by Maxim
Here it is.

Expression: /(Konachan\.com%20-%20\d+)
Result: [#1]

\s in Regular Expression means "one space character" (space or tab)
\d+ means "one or more digits"

But your actual URL did not contain space characters - they were encoded with "%20".

And yes, file name manipulations will be upgraded in EPF 4.x.