How to Remove Extra Digits from File Names in Bulk
Question details
The user needs to remove specific trailing characters and digits (such as '-44') from the end of multiple file names while keeping the original base name intact.

- Product
- File Management
- Device & OS
- not provided
- Scenario
- Batch renaming files to strip off unnecessary digits appended to the end of the file name.
- Observed behavior
- File names currently contain unwanted trailing digits separated by hyphens that need to be removed across multiple files simultaneously.
Ensure that none of the target files are currently open in any software applications, as the operating system will lock them and block any renaming operations, resulting in a 'File in Use' error.
Use Microsoft PowerToys for Batch Renaming
PowerRename is a free extension included in Microsoft PowerToys that supports bulk renaming using basic search-and-replace or regular expressions.
This utility seamlessly integrates into the Windows right-click context menu, making it incredibly fast to remove exact patterns, such as the last two digits and a hyphen, from hundreds of files.
Download and install Microsoft PowerToys from the Microsoft Store or official website, and ensure the PowerRename module is toggled on in the settings.
Open File Explorer, highlight all the files you want to rename, right-click the selection, and click on 'PowerRename'.
Check the 'Use Regular Expressions' box. In the 'Search for' field, type '-\d{2}$' (without quotes) to target a hyphen followed by exactly two digits at the end of the name.
Leave the 'Replace with' field completely blank. Review the 'Preview' pane to ensure the new file names look correct, then click 'Apply'.

Use a Windows PowerShell Command
For users comfortable with command-line tools, Windows PowerShell can instantly strip specific characters from the end of file names without requiring third-party installations.
Use WPS Spreadsheet to Clean Up File Names and Generate Scripts
If you are not comfortable using command line interfaces or regular expressions, you can use WPS Spreadsheet's powerful text functions to cleanly process file names and generate a simple batch renaming script.
- 1. Export Your File List: Open the Command Prompt, navigate to your folder, and type 'dir /b > filelist.txt' to generate a text file containing all your current file names.
- 2. Open in WPS Spreadsheet: Launch WPS Spreadsheet and open the 'filelist.txt' file. Your original file names will appear neatly in Column A.
- 3. Extract the Base Name: In Column B, use the formula '=LEFT(A1, LEN(A1)-3)' to drop the last three characters (the hyphen and two digits) from the file name.
- 4. Generate the Rename Command: In Column C, combine the names into a command using the formula: ="REN """&A1&""" """&B1&""""
- 5. Run the Batch Script: Copy all the generated commands from Column C, paste them into a new Notepad document, save the file as 'rename.bat', and double-click it in your folder to rename the files.

Frequently Asked Questions
Can I use standard Windows File Explorer to remove specific digits from file names?
The native Windows File Explorer batch rename feature is very basic. If you select multiple files and rename them, it simply assigns the same base name to all files followed by an incrementing number in parentheses (e.g., File(1), File(2)). It cannot strategically remove specific trailing digits from unique file names.
Why do I get a 'file in use' error when trying to batch rename my documents?
This error occurs because one or more files in your selection are currently open in a program or locked by a background process. You must completely close the files, and the applications using them, before the operating system will allow you to alter their names.
How can I remove characters from the beginning of a file name instead of the end?
If using WPS Spreadsheet to generate a script, you can use the RIGHT formula or the REPLACE formula to strip leading characters. For example, '=RIGHT(A1, LEN(A1)-3)' removes the first three characters. In Microsoft PowerToys PowerRename, you would use a regular expression targeting the beginning of the string, such as '^.{3}'.




