When a fixed position in a file name contains a city code, region abbreviation, or project identifier, this pattern can be used for automatic filing. This article uses txt files where characters 4 to 6 are city codes as an example to demonstrate how to select "Classify files by file name" in HeSoft Doc Batch Tool , import the files, set "Classify by characters within a custom position range", fill in the range 4:6, and ultimately generate classified folders such as LON, NYC, PAR, SYD, and TYO.
Files exported from many business systems often follow fixed naming conventions, for example, the first few digits are a serial number, the middle digits are a city code or region code, and the end digits are an order number, customer number, or time code. This naming style is convenient for system identification but not necessarily easy for manual organization. For instance, if you receive a batch of files and need to group together those with the same city codes like LON, NYC, PAR, SYD, and TYO, checking each file name and then moving them individually will quickly increase the workload.
Focusing on the need to "batch classify many files based on characters within a fixed range in their file names," this article introduces how to use HeSoft Doc Batch Tool to achieve automatic archiving. The example files are in TXT format, but the method is equally suitable for common office files, such as Word documents (DOC and DOCX), Excel spreadsheets (XLS and XLSX), PDF materials, image files, and more. As long as the characters used for classification are at a fixed position in the file name, they can be processed using the same approach.
Applicable Scenarios: File Names Contain City, Region, or Project Codes at Fixed Positions
This classification method is best suited for situations where "file names have a pattern, but the number of files is large." For example, in the file name "128LON75957.txt," LON represents a city or region; "200LON66460.txt" also belongs to LON; "213TYO11946.txt" belongs to TYO; "230SYD60610.txt" belongs to SYD. If these codes are all located from the 4th to the 6th character of the file name, you can set a fixed range to let the software automatically extract these three characters.
Besides city codes, similar scenarios include: contract file names containing department codes, report file names containing store numbers, PDF scans containing customer abbreviations, DOCX documents containing project codes, and XLSX spreadsheets containing business line abbreviations. When sorting manually, users need to constantly identify file names; after using batch processing software, you only need to configure the rule once to complete the organization of the entire batch of files.
The key here is not the file type, but the file naming rule. Even if a folder contains TXT, DOCX, PDF, and other files simultaneously, as long as their classification characters are all within the same range, they can be categorized this way. Of course, before formal processing, it is still recommended to check the consistency of the file names to avoid mixing in files that do not follow the rule.
Effect Preview: File Naming Characteristics Before Processing
Before processing, multiple TXT files are concentrated in the same directory. In the screenshot, you can see that the first part of the file names all have three digits, immediately followed by three English letters, such as LON, TYO, SYD, PAR, etc. Red highlighting emphasizes these code positions, indicating that these characters are the basis for classification.

Looking at the naming structure, the classification characters of the example files are very stable: the 1st to 3rd positions are digits, the 4th to 6th positions are English codes, followed by other numbers. Therefore, there is no need to manually determine the ownership of each file or open the file to check its content; you only need to extract the 4th to 6th characters of the file name to complete the classification.
Effect Preview: Directory Structure After Processing
After processing, multiple folders are generated in the target location, named LON, NYC, PAR, SYD, and TYO respectively. Each folder corresponds to a code extracted from the file names. For example, all files where the 4th to 6th characters are NYC will go into the NYC folder, and all files where the 4th to 6th characters are PAR will go into the PAR folder.

Such organized results can be used directly in subsequent office workflows. For instance, you can send files from different cities to the respective responsible persons, compress and package them by project code, or upload them in batch by folder in an archiving system. Compared to manual organization, the directory structure is clearer and easier to review.
Operation Steps: Batch Classification by Fixed Range in File Name
Step 1: Select the "Classify by File Name" Feature under File Organization
After opening HeSoft Doc Batch Tool , go to "File Organization" in the left menu. In the function area, select "Classify files by file name". As seen in the screenshot, the software is positioned as a batch document processing tool, and the left side also includes modules like Word Tools, Excel Tools, PowerPoint Tools, PDF Tools, Text Tools, and Image Tools, suitable for handling various office files.

We are using the classification capability within File Organization this time, aiming to create classification directories based on file names. After selecting this feature, you will enter the specific task page.
Step 2: Import the Files to be Processed
On the task page, first complete "Select Records to Process." At the top of the interface, you can see operation entries like "Add Files" and "Import Files from Folder." For a large number of files already located in the same directory, importing from a folder is recommended; if you only need to process some files, you can add them individually.

After importing, the files will be displayed in a table. The table includes fields such as Name, Path, Extension, Creation Time, and Modification Time for user verification. The screenshot lists files like 128LON75957.txt, 200LON66460.txt, 213TYO11946.txt, 230SYD60610.txt, all with a TXT extension and a record count of 20. After confirming no files are missing or incorrectly selected, click "Next."
Step 3: Set Classification Method to Custom Position Range
After entering "Set Processing Options", choose "Classify by characters within a custom position range" under "Classification Method." This option is very suitable for this example because the city code does not appear at the beginning of the file name but at a fixed middle position.

If you choose "Classify by the first character," the software will classify by the first digit, which clearly does not meet the requirements of this example; if you choose "Classify by the first few characters," it will also capture the preceding numeric digits, not the city code. Therefore, when the classification characters are in the middle, you should prioritize using the custom position range.
Step 4: Enter Range 4:6 to Extract Characters from the 4th to 6th Position
Enter "4:6" in the "Range" input box. This setting tells the software: Extract characters from the 4th to the 6th position of the file name as the classification name. Taking "128LON75957.txt" as an example, the extraction result is LON; for "254SYD54598.txt", the result is SYD; for "662PAR30266.txt", the result is PAR.
To avoid entering the wrong range, you can first manually verify with one file name. Break down "128LON75957" by character position: the 1st character is 1, the 2nd is 2, the 3rd is 8, the 4th is L, the 5th is O, the 6th is N. From this, you can see the range should be written as 4:6. As long as the naming rules for other files are consistent, the software can apply the same rule to the entire batch.
Step 5: Confirm Letter Case Handling
In the "Letter Case Conversion" area, "Default" is selected in the example. This means the software will generate the classification name based on the original characters in the file name. Since the codes in the screenshot are all uppercase, the default setting will result in folders like LON, NYC, PAR, SYD, TYO.
If the actual files come from different systems, the case may not be uniform. For example, the same city might appear as "nyc", "NYC", or "Nyc". In this case, you can choose to uniformly convert to uppercase or lowercase based on actual management requirements, avoiding the creation of multiple folders with the same meaning but different names.
Step 6: Set the Save Location and Execute Processing
After completing the processing options, continue by clicking "Next" to enter "Set Save Location." The choice of save location affects where the processed folders will be stored. It is recommended to select an output directory that is easy to find and check, especially when using the rule for the first time; outputting to a test directory is safer.
Then enter "Start Processing." The software will read each file name according to the settings, extract characters from the 4th to the 6th position, and move the files into corresponding folders based on the extraction results. After processing is complete, you will see the classification folders generated by city code.
Common Questions and Operation Suggestions
1. Why is it important to check the file list first?
Batch processing is highly efficient, but its premise is correct input files. If files with different naming rules are imported by mistake, the software will still extract characters based on the same range, potentially generating abnormal classifications. Therefore, reviewing the list after import is an important step to ensure the accuracy of the processing results.
2. Can files with Chinese characters in their names be classified?
Yes. Classification by custom position range is not limited to English. As long as Chinese characters, digits, or letters are at fixed positions, they can be used as the basis for classification. However, when dealing with mixed Chinese and English names, it is even more important to check whether the character positions are consistent.
3. Do I need to back up the original files before processing?
If the files are very important, it is recommended to keep a copy of the original directory, or set the output location to a new folder. This way, even if the rule configuration is wrong, you can adjust it and reprocess without affecting the original materials.
4. What types of office files is this suitable for?
Besides the TXT files in this article, a similar method applies to Word documents (DOC, DOCX), Excel spreadsheets (XLS, XLSX), PDF files, PPT presentations, and image materials. The key lies in whether a stable classification field exists within the file name.
Summary: Using Naming Conventions to Improve File Organization Efficiency
When fixed positions in file names contain city codes, region codes, or project identifiers, there is no need to rely on manual dragging and dropping for classification anymore. Through HeSoft Doc Batch Tool , you can select "Classify files by file name" in the File Organization module, import the files, set "Classify by characters within a custom position range", fill in the range 4:6, and finally set the save location and start processing.
This method transforms the repetitive steps of manually identifying file names, creating folders, and moving files into a single rule configuration. For office workers who frequently handle large volumes of TXT, DOCX, PDF, and XLSX files, it can effectively save time, reduce error rates, and make the archive directory more standardized. It is recommended to confirm the file naming rules before formal processing, and then execute the batch classification step by step.