Page 1 of 1

Remove "dots" in movie names

Posted: 14 Nov 2025 00:23
by haaranoos
Hello

I have a situation in some download sites where they have a tendency to use dots, like "Mymovie.To.you..When.mp4".
I want a script to remove those dots and make it nice and clean. Mymovie To you Wehn.mp4
ist it possbiel.
Thank you very much

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 01:08
by highend

Code: Select all

    $videos = quicksearch("/types={:Video}");
    end (!$videos), "No video(s) found in the current folder (incl. subfolder(s)), aborted!";

    setting "BackgroundFileOps", 0;
    $cnt = 0;
    foreach($video, $videos, <crlf>, "e") {
         $base = gpc($video, "base");
         if (regexmatches($base, "\.")) {
            $newBase = regexreplace($base, "\.+", " ");
            if ($newBase != $base) {
                $cnt++;
                renameitem($newBase, $video);
            }
        }
    }
    if ($cnt) { e "Renamed $cnt video file(s)" };

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 08:39
by admin
Or rename s, "./ "; to do it for all selected list items.

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 08:44
by highend
Which does remove multiple following dots but not condense them into a single space

This could be made more efficient if there would be an option for the RegExp Rename... to just operate on the base name (everything in a folder name, everything but excluding the . + ext in a file name).
Maybe a option box in the dialog window for it:
[ ] Exclude extension

or
[ ] On base name only

?

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 08:59
by admin
The "b", "s", and "k" modes all work on the base by default. I'm surprised that "r" does not. But okay, it's been like this forever and it's clearly documented in the help and in the interface.

Would there be any ambiguities if there was an option for a final /b switch appended to the regexp term, meaning it would only affect the base? (Asking for a friend who doesn't know regexp.) For example: o > n /b (replace all o by n, but only in the base)

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 11:24
by highend
As long as /b is the last part of the "to replace with" term and _only_ its leading space is removed before applying it, I don't see any problems using it

\. > <one space>/b
\. > <two spaces>/b
\. > <three spaces>/b

must all lead to different results

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 11:40
by admin
Cool. Next beta you can do this:

Code: Select all

rename r, "\. >   /b";
3 spaces, one from " > ", one " " to replace with, one from " /b".

PS: Ha! I taught the C tag to respect white space without collapsing it. :beer: No more quotes necessary:
3 spaces, one from > , one to replace with, one from /b.

Re: Remove "dots" in movie names

Posted: 14 Nov 2025 11:47
by highend
Looks good to me

Re: Remove "dots" in movie names

Posted: 16 Nov 2025 00:26
by haaranoos
highend wrote: 14 Nov 2025 01:08

Code: Select all

    $videos = quicksearch("/types={:Video}");
    end (!$videos), "No video(s) found in the current folder (incl. subfolder(s)), aborted!";

    setting "BackgroundFileOps", 0;
    $cnt = 0;
    foreach($video, $videos, <crlf>, "e") {
         $base = gpc($video, "base");
         if (regexmatches($base, "\.")) {
            $newBase = regexreplace($base, "\.+", " ");
            if ($newBase != $base) {
                $cnt++;
                renameitem($newBase, $video);
            }
        }
    }
    if ($cnt) { e "Renamed $cnt video file(s)" };
Thank you, fantastic really :appl:

Re: Remove "dots" in movie names

Posted: 25 Dec 2025 01:13
by haaranoos
Hello

I wanted to play smart and added one line more to remove extra Spaces (if any) too, but it didn't work!
Is this the right approach, or am I completely off the mark?
thank you

Code: Select all

 $videos = quicksearch("/types={:Video}");
    end (!$videos), "No video(s) found in the current folder (incl. subfolder(s)), aborted!";

    setting "BackgroundFileOps", 0;
    $cnt = 0;
    foreach($video, $videos, <crlf>, "e") {
         $base = gpc($video, "base");
         if (regexmatches($base, "\.")) {
            $newBase = regexreplace($base, "\.+", " ");
            $newBase = regexreplace($base, "\s+", " ");
            if ($newBase != $base) {
                $cnt++;
                renameitem($newBase, $video);
            }
        }
    }
    if ($cnt) { e "Renamed $cnt video file(s)" };

Re: Remove "dots" in movie names

Posted: 27 Dec 2025 14:32
by highend
Ehm, my script already reduced all following spaces into one?

Since v27.20.0304 this works as well (for all selected items)

Code: Select all

rename "r", "\.+ >   /b";

Re: Remove "dots" in movie names

Posted: 28 Dec 2025 14:28
by haaranoos
You are exactly right!
I updated my XYplorer, and all is fine! :beer:
Thank you very much