remove the last word

Advanced Renamer forum
#1 : 23/12-21 06:58
baboolec
baboolec
Posts: 8
is there a chance to remove the last word?
example:
Lolita.LOLITA-01-ABOOK-Nabokov.Vladimir
>>
Lolita.LOLITA-01-ABOOK-Nabokov


23/12-21 06:58
#2 : 23/12-21 10:21
David Lee
David Lee
Posts: 1125
Replace method...

Replace: \.[^\.]*$
with: leave blank
Use regular expressions


23/12-21 10:21
#3 : 23/12-21 17:02
baboolec
baboolec
Posts: 8
Reply to #2:
I'm sorry but it doesn't work


23/12-21 17:02
#4 : 23/12-21 18:24
David Lee
David Lee
Posts: 1125
Reply to #3:
That is because of the confusion between "." as part of the filename and "." as the separator between filename and extension. Windows will always assume that the end-most instance of "." indicates the extension and will treat any previous instances as plain text.

Thus.
In: Lolita.LOLITA-01-ABOOK-Nabokov.Vladimir
filename = "Lolita.LOLITA-01-ABOOK-Nabokov"
and extension = ".Vladimir"

In this case you can remove ".Vladimir" by simply deleting the extension...

Replace: *
with: blank
Use regular expressions: NOT checked
Apply to: Extension

However, in the result "Lolita.LOLITA-01-ABOOK-Nabokov"
the filename is now just "Lolita"
and the new extension will now be: "LOLITA-01-ABOOK-Nabokov"

Note that ARen will show an Error message "Extension changed" but this is only a warning and the batch will run and delete the extensions.

Using "." as part of a filename is always a bad idea!

I had assumed that your example just showed the filename and there would also an unspecified extension - eg "Lolita.LOLITA-01-ABOOK-Nabokov.Vladimir.txt" - in which case my solution will work.


23/12-21 18:24 - edited 23/12-21 18:26
#5 : 24/12-21 09:28
baboolec
baboolec
Posts: 8
Reply to #4:
:))))
I think I forgot to mention that I want to rename folders, sorry


24/12-21 09:28
#6 : 24/12-21 11:07
David Lee
David Lee
Posts: 1125
Reply to #5:
If you are renaming folders then there is no reason why my original solution would not work.

I can confirm the folder "Lolita.LOLITA-01-ABOOK-Nabokov.Vladimir" is renamed to "Lolita.LOLITA-01-ABOOK-Nabokov", as required.

Check that you are entering the arguments correctly...

Replace Method
Text to be replaced: "\.[^\.]*$" (do not include the quotes)
Replace with: leave this blank
Occurrence: All or 1st
Case sensitive: irrelevant
Apply to: checked


24/12-21 11:07
#7 : 24/12-21 14:35
baboolec
baboolec
Posts: 8
Reply to #6:
ok
thx


24/12-21 14:35