Page 1 of 1

Rename by substring

Posted: 25 Oct 2019 22:15
by highend
Imagine you have files (or folders) like this:
and you want to rename them by removing all parts apart from FIRSTNAME, LASTNAME and
the ascending number before the extension. Additionally we want to replace all used
separators (dots, underscores) with a single one, e.g. a hyphen.

The resulting names should be:
This would require a regex rename in XY...

To make things a bit easier I wrote this little script. It is a "define the parts to keep" from a file/
folder name. It throws away all other parts. File extensions are retained. It's nothing more
than a little regexp pattern / remove part generator...

It requires a two step process. In the first one you need to enter the separator(s) that are used to
chop the names into parts. These separators are remembered between each call of the script.
The script assumes that all selected files / folders are named using the same pattern (= have
the same separators and the same number of parts. File extensions don't count as a part).

You can define a single separator to use in the final output if you add a trailing "|" to the input,
followed by the separator you need.
E.g. for the above we would use .,_|-...
separators.png (4.09 KiB) Viewed 836 times
In the second step you're entering the numbers of the blocks you want to keep, separated
by commas. E.g. for the above example we would need to use: 1,2,7...
keep.png (3.14 KiB) Viewed 935 times
The result would look like this:
result.png (12.52 KiB) Viewed 836 times
Current version:
Rename by substring_v0.3.xys
(6.27 KiB) Downloaded 85 times
Old version(s):
Rename by substring_v0.2.xys
(5.57 KiB) Downloaded 50 times
Rename by substring_v0.1.xys
(3.66 KiB) Downloaded 49 times
Version history:
+++ major new feature
+ new feature
* changed feature
- removed feature
% improved performance
! fixed minor bug
!!! fixed major bug

+ Support for replacing all separators with a single one. E.g. you could
replace all hyphens and underscores with a dot, etc.

+ Support for multiple separators. Enter them with either a comma or a
semicolon between them! E.g.: to use a dot, a hyphen and an underscore,
a.) .,-,_
b.) .;-;_
The order of the entered separators does NOT matter!

• Initial release

Re: Rename by substring

Posted: 27 Oct 2019 09:01
by highend
v0.2 uploaded

Multiple separators are now supported (otherwise you wouldn't be able to do the renaming for more complex files)...

Re: Rename by substring

Posted: 08 Nov 2019 17:54
by highend
v0.3 uploaded

Now you can define a separator for the final output that is used to replace all other ones.
E.g. If the input files use a dot and an underscore you could create an output that only
uses a hyphen instead...