Neeed a script or method to batch rename file+folder, test.one.two_three.TXT ======> Test One Two Three.txt

Discuss and share scripts and script files...
Post Reply
shuklaharshit75
Posts: 42
Joined: 10 Aug 2024 10:12

Neeed a script or method to batch rename file+folder, test.one.two_three.TXT ======> Test One Two Three.txt

Post by shuklaharshit75 »

test.one.two_three.TXT ======> Test One Two Three.txt (For batch folder and files)

Replace dots with space, _ with space, lower extension, first letter of all word uppercase, lower extension.

1) Can it be done by mouse middle click button (after selecting files/folders) ?
Screenshot 2025-07-09 021230.png
Screenshot 2025-07-09 021230.png (7.39 KiB) Viewed 4672 times
Screenshot 2025-07-09 021851.png
Screenshot 2025-07-09 021851.png (44.43 KiB) Viewed 4672 times

2) If not then provide me script.
Screenshot 2025-07-09 020343.png
Screenshot 2025-07-09 020343.png (72.81 KiB) Viewed 4672 times
i tried using chatgpt for script but failed for hours, dont have technical knowledge.
thanks.

xyplorer version 27.00.0800

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Need a script or method to batch rename file+folder, test.one.two_three.TXT ======> Test One Two Three.txt

Post by jupe »

Here's one lazy way to achieve it,

rename s, "._> "; #126;

shuklaharshit75
Posts: 42
Joined: 10 Aug 2024 10:12

Re: Neeed a script or method to batch rename file+folder, test.one.two_three.TXT ======> Test One Two Three.txt

Post by shuklaharshit75 »

i used chatgpt and your given script. here is short summary. but coudnt Collapses multiple spaces into one and Removes trailing spaces.???
Screenshot (11).png
Screenshot (11).png (136.68 KiB) Viewed 4616 times
Screenshot (12).png
Screenshot (12).png (137.48 KiB) Viewed 4616 times
1) FOR FILE RENAMING=

rename s, ".-_ > "; #126; #113;


What it does:
Replaces ., _, and - with spaces

Capitalizes only the first word, rest lowercase (#126)

Copies the base name (without extension) to clipboard (#113)

🧪 Example:
Before:
my_file-name.TXT

After rename:
My file name.txt

Copied to clipboard:
My file name



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2) FOR FOLDER RENAMING=

rename s, ".-_ >_"; #128; rename s, " >_"; #113;


Step-by-Step Explanation:
rename s, ".-_ >_"
 ➡ Replaces dot (.), underscore (_) already present, and dash (-) with a single underscore

#128
 ➡ Capitalizes every word AND converts everything to UPPERCASE
  Example: my name → MY NAME

rename s, " >_"
 ➡ Replaces spaces (added during capitalization) with underscores → MY_NAME

#113
 ➡ Copies the base name only (no extension) to clipboard

🧪 Example:
Input:

perl
Copy
Edit
my-file_name.test.txt
After Rename:

css
Copy
Edit
MY_FILE_NAME_TEST.txt`

Copied to Clipboard:

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Neeed a script or method to batch rename file+folder, test.one.two_three.TXT ======> Test One Two Three.txt

Post by jupe »

shuklaharshit75 wrote: 09 Jul 2025 20:39 i used chatgpt and your given script. here is short summary. but coudnt Collapses multiple spaces into one and Removes trailing spaces.???
You didn't originally ask for multiple spaces to be changed to single, or for trailing spaces removed so I didn't offer that, anyway below is a untested (I'm on my phone) mod, it's still a lazy ver though instead of me scripting it properly.

Code: Select all

rename s, "-._> "; rename r, "\s+ >  "; rename r, "\s+(\.[^.]+?$|$) > $1"; #126;
Please don't post chatgpt nonsense.

Post Reply