Mass renaming tool replaces file extension dot

Please report only one bug per message!

Moderators: Stefan2, white, sheep, Hacker

Post Reply
ThiefMaster
Junior Member
Junior Member
Posts: 78
Joined: 2003-10-27, 16:49 UTC
Contact:

Mass renaming tool replaces file extension dot

Post by *ThiefMaster » 2010-04-16, 08:52 UTC

When replacing '.' with something else in the mass renamer, the dot separating name and extension is replaced, too.
However, since filename and extension are handled separately in the tool, there should be an option to disable touching of that dot.

For example, certain files usually have dots in the filename instead of spaces. When removing those dots I have to do it like that right now:
- replace . with a space
- remove the last 4 chars (space + extension)
- rename the file to [N] with extension <old-extension>
So I need to run three mass-renames even though I just want to get rid of dots in the filename...

User avatar
MVV
Power Member
Power Member
Posts: 8088
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2010-04-16, 09:14 UTC

I may suggest to use two-step rename. Instructions:
1. Fill name field as you wush.
2. Fill extension field as you wish but add some unique prefix like ^DOT^ (e.g. ^DOT^[E]).
3. Fill 'replace what' and 'replace with' fields as you wish.
4. Append to 'replace what' field following:

Code: Select all

|^DOT^
5. Append to 'replace with' field following:

Code: Select all

|.
So, TC will replace your dots with something useful for you and then will replace ^DOT^ before extension with dot. :)

E.g. if you wish to replace dots with spaces, use:
Name:

Code: Select all

[N]
Ext:

Code: Select all

^DOT^[E]
Replace what:

Code: Select all

.| ^DOT^
Replace with:

Code: Select all

 |.
And don't forget to save this crazy preset. :wink:
Last edited by MVV on 2010-04-16, 09:22 UTC, edited 3 times in total.

ThiefMaster
Junior Member
Junior Member
Posts: 78
Joined: 2003-10-27, 16:49 UTC
Contact:

Post by *ThiefMaster » 2010-04-16, 09:19 UTC

Good idea, but being able to do it without such tricks would be better. ;)

User avatar
MVV
Power Member
Power Member
Posts: 8088
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2010-04-16, 09:21 UTC

I think it is easier to use such trick than to modify code so this will work w/o such tricks. Who knows, maybe some people like current behaviour.

Rekrul
Junior Member
Junior Member
Posts: 20
Joined: 2007-11-04, 21:40 UTC

Re: Mass renaming tool replaces file extension dot

Post by *Rekrul » 2010-07-29, 08:42 UTC

ThiefMaster wrote:When replacing '.' with something else in the mass renamer, the dot separating name and extension is replaced, too.
However, since filename and extension are handled separately in the tool, there should be an option to disable touching of that dot.

For example, certain files usually have dots in the filename instead of spaces. When removing those dots I have to do it like that right now:
- replace . with a space
- remove the last 4 chars (space + extension)
- rename the file to [N] with extension <old-extension>
So I need to run three mass-renames even though I just want to get rid of dots in the filename...
Here you go, one-step renaming of "." while leaving the final period and extension in place.

In the rename mask box, put the following;

Code: Select all

[N]^^[E]
Erase the contents of the Extension box.

In the search for box, put this;

Code: Select all

.|^^
In the replace box, put this;

Code: Select all

 |.
(Note that there's a space before the line)

Feel free to change "^^" to the pattern of your choice.

Presto! All periods will be changed to spaces, except the last one.

Why this works;

TC treats the extension as a separate part of the filename. When something is placed in the extension box, TC is hardcoded to place those characters after the filename separated by a period, and that period is then subjected to the search & replace rules. By erasing the contents of the extension box, you're telling TC that you don't want an extension. When you place the "[E]" tag in the filename box, it simply becomes part of the filename. You can then replace "^^" with a period, because the periods in the filename have already been changed. This happens because the search is carried out left to right. Note that if you reversed the contents of the search & replace boxes to replace the "^^" first, you'd end up with the same problem as you originally had. But by replacing it second, there's no problem changing it to a period. :)

Post Reply