Page 1 of 1

Help with Rename Script – Capitalize All Words (incl. A, An, The, Of etc)

Posted: 20 Aug 2025 15:33
by shuklaharshit75
Replace all unwanted characters (- . _ [ ] ( ) % , \ * ~ >`) with a single space.

Collapse multiple spaces into one.

Trim leading/trailing spaces.

Capitalize the first letter of every word, including single-letter words like “A”.

Always lowercase the extension.

What I have tried:

Code: Select all

rename s, "-._[]()%,`*~> ", , , 8; rename r, "\s+ >  ", , , 8;; rename r, "\s+(\.[^.]+?$|$) > $1", , , 8; #139; #128; #126; #113;
I already have a partially working script that cleans up filenames and lowercases extensions. However, words like “a”, “an”, “the”, and “of” are automatically lowercased.



Original:

Code: Select all

_a an the of ..--___.txt
Current Result:

Code: Select all

A an the Of.txt
Desired Result:

Code: Select all

A An The Of.txt
Thanks in advance.

Re: Help with Rename Script – Capitalize All Words (incl. A, An, The, Of etc)

Posted: 20 Aug 2025 18:02
by Horst
What about all the options under
File / Rename Special >

Re: Help with Rename Script – Capitalize All Words (incl. A, An, The, Of etc)

Posted: 20 Aug 2025 22:13
by shuklaharshit75
Rename special #126 doesn't work.
AAAAAAAA.gif
I already have a partially working script that cleans up filenames and lowercases extensions. However, words like “a”, “an”, “the”, and “of” are automatically lowercased.

Code: Select all

rename s, "-._[]()%,`*~> ", , , 8; rename r, "\s+ >  ", , , 8;; rename r, "\s+(\.[^.]+?$|$) > $1", , , 8; #139; #128; #126; #113;

Re: Help with Rename Script – Capitalize All Words (incl. A, An, The, Of etc)

Posted: 23 Aug 2025 12:40
by shuklaharshit75
found a workaround solution. How to Implement True Title Case Formatting in XYplorer

1️⃣ **Locate XYplorer.ini**: Open XYplorer and navigate to **File | Save Settings** to ensure the necessary key exists in the XYplorer.ini file.

2️⃣ **Open Configuration File**: Go to **Tools | Open Configuration File...** to open the XYplorer.ini file in your default text editor.

3️⃣ **Edit the Key**: In the text editor, find the key you want to edit, such as `RenameTitleCaseExceptions=`. Make sure to edit its value rather than creating a new key.

4️⃣ **Example of Editing**: For instance, if the original line is `SettingsWarnReadonly=0`, change it to `SettingsWarnReadonly=1`.

5️⃣ **Save Changes**: After making the necessary edits, save the file in your text editor.


6️⃣ **Restart XYplorer**: In XYplorer, click **File | Restart without Saving** to apply the changes made to the ini file.

7️⃣ **Confirm Tweaks**: The changes should now take effect, allowing XYplorer to utilize the tweaked settings.



working script((Custom Events=>Clicking On Items Middle Click On File))=

Code: Select all

rename s, "-._[]()%,`*~> ", , , 8; rename r, "\s+ >  ", , , 8; rename r, "\s+(\.[^.]+?$|$) > $1", , , 8; #139; #126; #113;


Step-by-Step Explanation
1️⃣ Remove Unwanted Characters:

Command: rename s, "-._[]()%,*~> ", , , 8;`
Explanation: This command removes specific unwanted characters from file names, including -, ., _, [, ], (, ), %, ,, `, *, and ~. The operation is limited to a maximum of 8 files at a time.
2️⃣ Replace Multiple Spaces:

Command: rename r, "\s+ > ", , , 8;
Explanation: This command replaces multiple consecutive spaces in file names with a single space. The regular expression \s+ matches one or more whitespace characters.
3️⃣ Handle Spaces Before File Extensions:

Command: rename r, "\s+(\.[^.]+?$|$) > $1", , , 8;
Explanation: This command ensures that there are no unnecessary spaces before file extensions or at the end of the file name. It matches spaces followed by a file extension or the end of the string.
4️⃣ Special Rename Operations:

Commands: #139; #126; #113;
Explanation: These commands refer to specific predefined renaming operations in XYplorer:
#139: Remove diacritics from file names.
#126: Change file names to Title Case (e.g., "AAA AA.AAA" to "Aaa Aa.aaa").
#113: Copy the base name(s) of the selected item(s) to the clipboard (Shift+F).
5️⃣ Additional Rename Operations:

Commands: #128, #129, #130, #136
Explanation: These commands perform various renaming tasks:
#128: Convert spaces in file names to underscores.
#130: Convert underscores in file names back to spaces.
#136: Rename files with a specific extension (e.g., *.aaa).