Multi-Rename Tool - "." > "_"
Moderators: Hacker, petermad, Stefan2, white
Multi-Rename Tool - "." > "_"
Hej.
I have tried to search on the forum and I haven't seen any problems like that. So, from time to time I get a bunch files like that:
Lyrics.I.Like.It.Like.That.txt
Lyrics.Listen.To.Your.Heart.txt
Lyrics.One.Wish.txt
Lyrics.The.Look.txt
and my task is to replace "." with "_" but leave the extension. If i use the multi-rename tool, it will replace .txt with _txt as well. so, I would get:
Lyrics_I_Like_It_Like_That_txt
instead of:
Lyrics_I_Like_It_Like_That.txt
So, is it possible to tell the multi-rename tool to multi-rename only the filename and leave the extension alone?
It is possible to write a regular expression, calculating the position of the last "." (it's not -3 because the extension might be longer or shorter than 3 symbols) and skip the part after this position but maybe ithere is something simplier to use that I don't know?
Thanks
I have tried to search on the forum and I haven't seen any problems like that. So, from time to time I get a bunch files like that:
Lyrics.I.Like.It.Like.That.txt
Lyrics.Listen.To.Your.Heart.txt
Lyrics.One.Wish.txt
Lyrics.The.Look.txt
and my task is to replace "." with "_" but leave the extension. If i use the multi-rename tool, it will replace .txt with _txt as well. so, I would get:
Lyrics_I_Like_It_Like_That_txt
instead of:
Lyrics_I_Like_It_Like_That.txt
So, is it possible to tell the multi-rename tool to multi-rename only the filename and leave the extension alone?
It is possible to write a regular expression, calculating the position of the last "." (it's not -3 because the extension might be longer or shorter than 3 symbols) and skip the part after this position but maybe ithere is something simplier to use that I don't know?
Thanks
[tridy]
License #: 79539
License #: 79539
tridy,
The easy way:
HTH
Roman
The easy way:
Code: Select all
Name: [N]
Extension: #[E]
Search for: .|_#
Replace with: _|.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- StickyNomad
- Power Member
- Posts: 1933
- Joined: 2004-01-10, 00:15 UTC
- Location: Germany
Well, this will work for the most of the time, unless you have # in the file name, in case of C# for instance or something similar. So, you need to make sure it's not a commonly used symbol. But I will stick to the one that you wrote.Hacker wrote:tridy,
The easy way:
HTHCode: Select all
Name: [N] Extension: #[E] Search for: .|_# Replace with: _|.
Roman
I thought before about having something with regular expressions:
Code: Select all
note: using regular expressions
Search for: (\.)([^\.]*)(\.)
Replace with: _$2$3
I tried to do it so there will be just a replacement for the "." except for the last one in the name but I couldn't do it. If I will come up with something else, I will post it.
Thanks for your help guys.
[tridy]
License #: 79539
License #: 79539
2Sans
It works fine here, I also made a variant (Replace . by Space )
Name: [N]
Extension: #[E]
Search for: .| #
Replace with: |.
Do not forget to add a space in last line [SPACE]|.
MRT Screenshot
It works fine here, I also made a variant (Replace . by Space )
Name: [N]
Extension: #[E]
Search for: .| #
Replace with: |.
Do not forget to add a space in last line [SPACE]|.
MRT Screenshot
Gil
Licence #17346
90% of coding is debugging. The other 10% is writing bugs.
Licence #17346
90% of coding is debugging. The other 10% is writing bugs.
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- StickyNomad
- Power Member
- Posts: 1933
- Joined: 2004-01-10, 00:15 UTC
- Location: Germany
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- StickyNomad
- Power Member
- Posts: 1933
- Joined: 2004-01-10, 00:15 UTC
- Location: Germany
If you can assume there is always a dot in the file name besides the one separating the file name and extension, you can use:tridy wrote: I tried to do it so there will be just a replacement for the "." except for the last one in the name but I couldn't do it. If I will come up with something else, I will post it.
Code: Select all
Search for: \.([^.]*\.[^.]*)$|\.
Replace with: _$1
(RegEx checked)
Thanks for the tips, but this is a simple to fix design flaw.
Or how many of us want to replace the dot separating the extension?
The truth is, that i'm sure that MRT is using a function call like:
newname = ReplaceChars(filename+"."+extension, fromchars, tochars)
and it should be a matter of simply changing it to
newname = ReplaceChars(filename, fromchars, tochars)+"."+ReplaceChars(extension, fromchars, tochars)
Simple fix. And it would be the EXPECTED behavior.
Or how many of us want to replace the dot separating the extension?
The truth is, that i'm sure that MRT is using a function call like:
newname = ReplaceChars(filename+"."+extension, fromchars, tochars)
and it should be a matter of simply changing it to
newname = ReplaceChars(filename, fromchars, tochars)+"."+ReplaceChars(extension, fromchars, tochars)
Simple fix. And it would be the EXPECTED behavior.