In daily file management, we often encounter situations where file names contain redundant suffixes or temporary tags, such as automatically generated date tags, version numbers, or temporary classification tags. These texts, which are generally located at the end of the far right of the file name, not only affect the overall cleanliness of the file name, but also may hinder file retrieval and sorting. When there are hundreds of files that need to be deleted and renamed, manual modification one by one is a waste of time and there is a risk of errors. Here are three ways to delete the right-most text of the file name in batch. According to the advantages and disadvantages, we can help you analyze and choose the most suitable option. Come and learn with me!
Under what circumstances do I need to delete the text content on the far right of the file name?
- When organizing files in batches, by deleting the text content on the far right of the file name, the extra version number or date can be removed, making the file name neat and uniform. ,
- when there are redundant suffixes such as timestamp or annotation information in the file name, deleting the text at the end can eliminate these redundant information, retain important content, and facilitate quick identification and search.
- When the file needs to be processed in the system or software tools, delete the redundant content at the end of the right can avoid the format of the file name is too long.
Preview of the effect of batch deleting the date mark on the far right of the file name
before treatment:
after treatment:
method 1: Use HeSoft Doc Batch Tool Batch Delete File Name Suffixes
recommend index:★★★★★
Advantages:
- support batch deletion of a large number of files to avoid manual operation one by one.
- All files are processed locally, do not involve the nature of the upload, to protect user privacy.
Disadvantages:
- need to install software to operate in the computer.
Operation steps:
1. Open 【 HeSoft Doc Batch Tool ], select [File Name]-[Delete Text in File Name]].
2. Select a method in [Add File] or [Import File from Folder] to add a file that needs to delete the rightmost text of the file name, or drag the file directly to the bottom. After confirming that there is no problem with the imported file, click Next.
3. Enter the option setting interface, select [several texts on the far right] in the operation type, and then select the number of characters to be deleted (characters calculated from right to left) in the lower quantity. After the selection is completed, click Next again. Then click Browse to select the location to save the new file after renaming.
4. After the processing is completed, click the red path of the save path to open the folder to view the processed files.
Method 2: Use Windows bat file batch to delete the specified number of words on the right side of the file name.
recommend index:★★★☆ ☆
advantages:
- fast processing speed, can handle large quantities of files.
- Windows native support, no additional software installed.
Disadvantages:
- files in subfolders cannot be processed at the same time.
- Cannot only recognize delimiters and cannot be restored after modification.
Operation steps:
1. Create a new TXT text file in the folder containing the file that needs to delete the suffix and rename it to remove_right_text.bat.
2. Right-click to edit and enter the code below.
@echo off setlocal enabledelayedexpansion for %%f in (*) do ( set "filename=%%~nf" set "newname=! filename:~0,-10! " ren "%%f ""! newname! %%~xf" )3. Double-click the running file after saving.
Method 3: Use the PowerShell command to uniformly delete part of the file name text
recommend index:★★★☆ ☆
advantages:
- supports regular expressions for complex matching rules to remove text.
- Windows official support, security risk-free.
Disadvantages:
- you need to learn basic command-line knowledge.
- There is a risk of error if there is no separator between file names.
Operation steps:
1. Hold down the Shift key and right-click the folder containing the file to be renamed, and select [Open PowerShell Window Here]].
2. Enter the command below.
Get-ChildItem | Rename-Item -NewName {
$base = $_. BaseName
$new = $base. Substring(0, $base.LastIndexOf(' '))
$new + $_. Extension
}
3. Then run the command.