Remove "dots" in movie names

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
haaranoos
Posts: 15
Joined: 29 Apr 2017 11:53

Remove "dots" in movie names

Post 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

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Remove "dots" in movie names

Post 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)" };
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 64849
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Remove "dots" in movie names

Post by admin »

Or rename s, "./ "; to do it for all selected list items.

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Remove "dots" in movie names

Post 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

?
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 64849
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Remove "dots" in movie names

Post 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)

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Remove "dots" in movie names

Post 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
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 64849
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Remove "dots" in movie names

Post 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.

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Remove "dots" in movie names

Post by highend »

Looks good to me
One of my scripts helped you out? Please donate via Paypal

haaranoos
Posts: 15
Joined: 29 Apr 2017 11:53

Re: Remove "dots" in movie names

Post 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:

Post Reply