How to batch sort files by the last 3 characters of the file name and automatically place them into corresponding folders


TranslationEnglishFrançaisDeutschEspañol日本語한국어Update Time2026-07-20 06:37:04

Disclaimer: All images, text, and video content on the website are for reference only and may not be the latest, correct, or accurate. In case of any dispute, please refer to the actual experience effect!

When a large number of files have naming rules that include fixed suffixes—such as LON, PAR, NYC, SYD, TYO, and other city codes—it becomes very time-consuming to manually filter, copy, and move files. This article explains how to use HeSoft Doc Batch Tool to automatically classify many files based on the last few characters of their filenames, batch-generate corresponding folders, and sort the files into them. This method is suitable for daily organization of various files including txt, doc, docx, xls, xlsx, pdf, and others.

In daily office tasks, many files appear to differ only in their numbering, but the end of the filename often contains key classification information. For example, filenames in the screenshot like 10102271LON.txt, 10103956PAR.txt, 10179839NYC.txt end with 3 characters—LON, PAR, NYC—that represent different categories. If there are only a dozen files, manual dragging and dropping might just be manageable; but once the number of files reaches dozens, hundreds, or even thousands, checking each filename and manually moving them to folders is prone to errors and wastes a significant amount of time.

The problem this article aims to solve is clear: batch categorize many files based on the last few characters of their filenames. In other words, the software will automatically determine the category based on the characters at the end of the filename and group similar files into folders of the same name. In the screenshot example, the files are ultimately organized into folders like LON, NYC, PAR, SYD, TYO. Below, we will use interface screenshots to explain how to use the office software HeSoft Doc Batch Tool to accomplish this type of batch file organization task.

Applicable Scenarios: Which files are suitable for categorization by end-of-filename characters

Categorizing by the end-of-filename characters is suitable for scenarios where filenames follow a fixed naming convention. Common situations include: area codes after file numbers, department abbreviations after order numbers, project codes at the end of contract names, business line abbreviations at the end of customer profiles, category labels at the end of images or scans, etc. As long as the classification basis for a batch of files consistently appears at the end of the filenames, this method can be used for batch organization.

For example, the last 3 characters of 10102271LON.txt are LON, the last 3 characters of 10103956PAR.txt are PAR, and the last 3 characters of 10202656TYO.txt are TYO. The software creates or matches corresponding folders based on these terminal characters and then moves the files into them. The 'txt' here is just an example; in real office work, this method can also be applied to Word documents (doc, docx), Excel spreadsheets (xls, xlsx), PDF files, image files, and other common document types. The core condition is not the file format, but whether the filename contains identifiable terminal classification characters.

The value of this type of batch processing lies in reducing repetitive tasks. When organizing manually, you repeatedly execute the actions of "checking the filename, determining the category, opening the target folder, and dragging in the file". With a batch processing tool, you only need to import files and set classification rules once; the subsequent folder creation and categorization actions are all performed by the software, making it more suitable for archiving large amounts of data in office scenarios.

Effect Preview: Before processing, files are mixed in the same directory

Before processing, all files are piled up in the same folder. Although the filenames already contain classification information, this information has not been translated into a folder structure. When a user needs to find a specific category of files, they must search or manually browse filenames to filter them, which is inefficient.

image-Classify files by the end of the file name,batch organize files,automatic file categorization,create folders by suffix,batch document processing tool

From the pre-processing screenshot, you can see that filenames consist of a numeric identifier plus a terminal letter code, such as LON, PAR, SYD, NYC, TYO. The area marked in red is precisely the classification basis this article will utilize: the last 3 characters of the filename base. If organizing manually, you would need to move LON files to the LON folder, PAR files to the PAR folder, and so on. The more files there are, the easier it is to miss or misplace them.

Effect Preview: After processing, classification folders are generated by terminal characters

After processing is complete, the same batch of files is automatically organized into multiple folders. In the screenshot, you can see that the system has generated folders like LON, NYC, PAR, SYD, TYO, each corresponding to a type of character at the end of the filenames.

image-Classify files by the end of the file name,batch organize files,automatic file categorization,create folders by suffix,batch document processing tool

This result is very suitable for subsequent archiving, packaging, delivery, or sharing. For example, if you need to send files for different cities, departments, or projects to corresponding personnel, you just need to open the relevant folder, eliminating the need to filter from a mixed collection. For personnel who frequently handle batches of documents, reports, orders, and scans, this method of automatic categorization based on filename rules can significantly reduce repetitive operations.

Operation Steps: Using HeSoft Doc Batch Tool to categorize by end-of-filename characters

The specific operations are explained below in the order of the screenshots. Since this example categorizes by the last 3 characters, the key settings are "Categorize by the last few characters" and "Number 3". If your filename rule is different, such as the last 2 or 4 characters, you can adjust the number according to the actual situation.

Step One: Enter the file organization function and select "Categorize files by filename"

After opening HeSoft Doc Batch Tool , you can see multiple office processing categories on the left function bar, such as File Name, Folder Name, File Organization, Word Tools, Excel Tools, PDF Tools, etc. As this article needs to organize file locations, select the File Organization category on the left.

image-Classify files by the end of the file name,batch organize files,automatic file categorization,create folders by suffix,batch document processing tool

On the File Organization page, select the function card "Categorize files by filename". As seen in the screenshot, the function description is "Batch categorize all files by filename". This task is not to categorize by extension or rename files, but to create classification directories based on a part of the filename, so this is the correct function to enter.

The purpose of this step is to tell the software that a file organization task is to be performed next, and that the classification basis comes from the filename. After selecting the correct function, the software will enter a wizard-style operation page, followed sequentially by selecting files, setting processing options, setting the save location, and starting the process.

Step Two: Add or import files that need to be processed

After entering the "Categorize files by filename" page, the top of the interface provides action options like Add Files, Import files from folder, Clear, More. For a small number of files, you can select them via "Add Files"; if the files are all in the same directory, it is more suitable to click "Import files from folder" to import all files from that folder at once.

image-Classify files by the end of the file name,batch organize files,automatic file categorization,create folders by suffix,batch document processing tool

After importing, the files will be displayed in the list. The list in the screenshot includes columns for Number, Name, Path, Extension, Creation Time, Modification Time, etc. Here you can check if all files were imported correctly and verify through the list whether the filenames meet the expected pattern. For example, the files in the screenshot are all located under the D:\test path, have the txt extension, and their names all contain a terminal 3-letter English code.

The purpose of this step is to add the files that will participate in the batch classification to the processing queue. Only files appearing in the list will be processed by the subsequent rules. If irrelevant files are found to have been imported, they can be removed via the delete icon in the operation column; if the wrong batch was imported, you can use "Clear" to reselect. After confirming the records are correct, click Next at the bottom to proceed to the processing options settings.

Step Three: Select "Categorize by the last few characters" and fill in the number

Upon entering the "Set Processing Options" page, you can see various classification methods, including by the first character, by the first digit, by the first English letter, by the first Chinese character, by the first few characters, by characters within a custom position range, by a custom regular expression, etc. This example needs to use the city code at the end of the filename, so select "Categorize by the last few characters".

image-Classify files by the end of the file name,batch organize files,automatic file categorization,create folders by suffix,batch document processing tool

After selecting this classification method, fill in 3 in the "Number" input box. This is because the classification codes in the example filenames—LON, PAR, NYC, SYD, TYO—are all 3 English letters. If your filenames end with a 2-letter department code, such as HR, IT, CW, fill in 2; if it's a 4-letter project code, fill in 4.

Below, you can also see the "Letter case conversion" area, where Default is selected in the screenshot. This means the software will classify based on the original letter case in the filenames. If your filename case is mixed—for example, lon, LON, Lon exist simultaneously—and you wish to unify the categorization, you can choose from the case conversion options provided in the interface according to your actual needs. In this article's example, the source file suffixes are all uppercase, so keeping the default is fine.

The expected result of this step is: the software will extract the specified number of characters from the end of each filename body as the classification name. For example, 10102271LON.txt would be classified under LON, 10179839NYC.txt under NYC, and 10209510TYO.txt under TYO. After completing the settings, continue by clicking Next.

Step Four: Set the save location and start processing

As can be seen from the interface flow, the wizard also includes the Set Save Location and Start Processing stages. After completing the classification rule settings, you need to follow the software prompts to choose where to save the processing results. It is recommended to select a new, empty folder as the output location, which makes it easy to verify the results and prevents mixing them with the original files.

After the save location is set, enter the start processing stage. Once you click start, the software will automatically identify the last 3 characters of each filename according to the previously set rules, create corresponding classification folders, and then place similar files into the respective folders. After processing is finished, you will see folders like LON, NYC, PAR, SYD, TYO in the target directory.

The purpose of this step is to actually apply the rules to the files. Compared to manual moving, the software completes the actions of judging, creating folders, and archiving in one go, suitable for file organization tasks that are highly repetitive and involve large quantities.

Common Questions and Notes

1. Do the "last few characters" include the extension like txt, docx, pdf?

Judging from the example results in the screenshot, the files were sorted into folders named LON, PAR, NYC, etc., not a txt folder, indicating that the last characters of the filename base were used, not the extension. This means 10102271LON.txt would be classified under LON, not under txt. In actual use, it is still recommended to test with a small number of files first, confirming the rule matches expectations before batch processing numerous files.

2. Can filenames of varying lengths be processed?

Yes, as long as the classification characters consistently appear at the end of the filename, this method can be used. The length of the preceding identifier can vary; for example, 10102271LON, A0001LON, Order202606LON, as long as the last 3 characters are the category code, they can all be grouped under LON. If some filenames lack a classification code at the end, incorrect characters might be extracted, so it's best to check the naming convention before batch processing.

3. Can Word, Excel, and PDF files also be organized this way?

Yes. This article uses txt files for demonstration to show the filename structure more clearly. In actual office work, as long as filenames contain fixed terminal classification characters, files like doc, docx, xls, xlsx, ppt, pptx, pdf, jpg, png can also be organized by naming rules. The software's core processing logic is to categorize by filename, not limited to a specific file format.

4. Should I process the original folder directly or save to a new location?

To facilitate verification, it is recommended to save the processing results to a new folder. This way, even if the settings do not meet expectations, the original directory structure will not be affected. Once you confirm the classification results are correct, you can then replace the original directory or continue archiving according to work needs.

5. What happens if the number is entered incorrectly?

If the number is entered incorrectly, the classification folder names will also not meet expectations. For example, this example requires entering 3; if 2 is mistakenly entered, LON might be classified under ON; if 4 is mistakenly entered, it might extract a part of the identifier's end plus the code. Therefore, the number must match the classification code's length exactly.

Summary: Turning filename rules into automated archiving rules

Batch categorizing by the last few characters of a filename is a very practical office file organization method. It utilizes the identifiers, codes, department, or region information already present in filenames to automatically generate classification folders and complete archiving, avoiding manual filtering and dragging. For users who need to organize large amounts of txt, docx, xlsx, pdf, images, or other materials, using HeSoft Doc Batch Tool can compress repetitive tasks into just a few steps.

If your filenames, like the example, have a fixed-length classification identifier at the end, you can follow the process in this article directly: enter File Organization, select "Categorize files by filename", import files, choose "Categorize by the last few characters", fill in the character count, set the save location, and start processing. It is recommended to validate the rules with a small sample first, then batch process the official files; this is both efficient and reliable.


KeywordClassify files by the end of the file name , batch organize files , automatic file categorization , create folders by suffix , batch document processing tool
Creation Time2026-07-20 06:36:49

Disclaimer: All images, text, and video content on the website are for reference only and may not be the latest, correct, or accurate. In case of any dispute, please refer to the actual experience effect!

Related Articles

Don't see the feature you want?

Provide us with your feedback, and after evaluation, we will implement it for free!