For files starting with numbers, manual classification can be time-consuming and error-prone. This article focuses on the need for "how to automatically archive files with numbers like 101, 102, 103 in their filenames," explaining how to import files in HeSoft Doc Batch Tool , choose classification by filename, and use custom regular expression classification to extract the first three digits of the filename, ultimately automatically generating corresponding folders and centrally storing files with the same numbers.
Many office documents are created with numbers, but they are often still piled into the same directory when saved. For example, text files exported from business systems, device logs, customer attachments, batch-downloaded reports, scanned documents, etc., might have file names like 101LON05417.txt, 102SYD15496.txt, 103LON28360.txt. The 101, 102, 103 at the beginning of the file names already indicate they belong to different categories, but without an automatic organization tool, users still need to select, copy, and move them one by one, which is very time-consuming.
This article introduces a batch archiving method suitable for office scenarios: using the Classify Files by Name function of " HeSoft Doc Batch Tool ", extracting the number from the file name through wildcard ideas and regular expression rules, and automatically creating category folders. In the example, we will use ^\d{3} to match the three digits at the beginning of the file name, letting the software automatically place files starting with 101 into the 101 folder, files starting with 102 into the 102 folder, and files starting with 103 into the 103 folder.
The focus of this method is not a specific file format, but the "file name rule". Therefore, although the example screenshots show TXT files, it is equally applicable to office files like doc, docx, xls, xlsx, ppt, pptx, PDF, JPG, PNG. As long as the file name contains extractable classification information, batch processing software can be used to reduce repetitive operations and improve file organization efficiency.
Applicable Scenarios: Especially suitable when file names contain numbers, codes, or dates
If you often face a bunch of files with similar naming but different classifications, it is very suitable to use automatic classification by file name. For example, common naming conventions in corporate materials include: Customer ID + City Code + Serial Number, Project ID + File Type + Date, Department ID + Employee ID + Form Name, Device ID + Log Type + Timestamp. For these types of files, what truly determines the archiving location is often just a small segment of characters in the file name.
When organizing manually, you need to first look at the file name, then judge which category it belongs to, and then create a new folder and move the file. This is acceptable if the quantity is small, but the error rate will increase significantly once the quantity is large. For example, accidentally dragging a file starting with 102 into the 101 folder, or missing a file, will cause trouble when searching later. The advantage of batch processing tools is consistent rules and stable execution. As long as the rules are set correctly, all files can be processed according to the same standard.
The number in this article is located at the beginning of the file name and has a fixed length of three digits, making it very suitable for matching with a regular expression. A regular expression can be understood as a more precise wildcard rule. Common wildcards are often used to represent "any character" or "any number of characters", while regular expressions can further specify position, character type, and length. For the requirement "the first three characters of the file name are digits", ^\d{3} is a concise and accurate way to write it.
Effect Preview: Before processing, files have numbers but are still mixed together
In the pre-processing screenshot, the file list contains files starting with 101, 102, and 103 simultaneously. Users can see from the file names that they should belong to different categories, but the files themselves have not yet been placed into different folders. At this point, if you want to gather all the 101 files together, you usually need to sort or search first, then manually select and move them.

As can be seen, the 101 group files include 101LON05417.txt, 101LON09060.txt, 101SYD60290.txt, etc.; the 102 group files include 102LON48897.txt, 102NYC53821.txt, 102TYO76564.txt, etc.; the 103 group files include 103LON23328.txt, 103LON26108.txt, 103SYD61045.txt, etc. The pattern in the file names is very clear, but if the number of files expands to hundreds, manual classification becomes a repetitive, tedious, and error-prone task.
Effect Preview: After processing, files with the same number enter the corresponding folder
After executing the batch classification, the software generates three folders: 101, 102, and 103, based on the number extracted from the beginning of the file name. This sort of organization result better aligns with data management habits and facilitates subsequent searching, packaging, backup, or sending by number.

The benefits after processing are direct: the folder name is the classification value, no need to create additional documentation; files with the same number are stored together, reducing search costs; if similar files come later, they can continue to be archived according to the same rules, keeping the directory structure uniform.
Operation Steps: Using HeSoft Doc Batch Tool to batch create folders by number
Step 1: Open the file organization function and enter Classify Files by Name
After starting HeSoft Doc Batch Tool , find File Organization in the left navigation bar. The File Organization module is geared towards batch office tasks like file archiving, classification, and organization. After entering this module, select Classify Files by Name.

The purpose of this step is to select the correct batch processing type. In the software interface, you can also see tools for classifying by extension, creating new folders based on existing folders, and modifying timestamps in file system properties, but what this article aims to achieve is "generating category folders based on numbers in file names", so "Classify Files by Name" should be selected. After selection, the software will enter a processing interface with step-by-step prompts.
Step 2: Import the files to be organized, first confirm the list is correct
After entering the function page, you first arrive at the "Select records to process" step. The top of the interface provides Add Files and Import Files from Folder. If your files are all in the same directory, it is recommended to use "Import Files from Folder"; if you only want to process some of them, you can use "Add Files" as appropriate.

After importing files, the list will display information like name, path, extension, creation time, modification time. The screenshot shows that the file paths are multiple txt files under D:\test, with 20 records. This list is equivalent to the pre-processing task list. It is recommended to check once before moving to the next step: confirm that the number of files is roughly correct, confirm that the file extensions meet expectations, and confirm that the names indeed contain the number to be extracted.
If the file name contains multiple numeric segments, you especially need to confirm which segment to extract this time. The number in this article is at the beginning, so we will later use a regular expression with a "start anchor". If the number is not at the beginning but in the middle or end, you need to change to a rule suitable for the actual naming pattern.
Step 3: Choose to classify by custom regular expression
After confirming the file list, click Next Step at the bottom to enter "Set Processing Options". This page provides multiple classification methods, such as classify by first character, classify by first digit, classify by first English letter, classify by the first few characters, classify by the last few characters, etc. For simple rules, these options are sufficient; but if you want to more accurately match "consecutive three digits at the beginning of the file name", using Classify by Custom Regular Expression is more secure.

In the interface, check Classify by Custom Regular Expression, then fill in the regular expression input box:
^\d{3}
The logic here is: only start searching from the beginning position of the file name, and only take three consecutive digits. For 101LON05417.txt, the match result is 101; for 102LON48897.txt, the match result is 102; for 103PAR08578.txt, the match result is 103. The software will use these match results as the classification basis, thus ultimately creating folders like 101, 102, 103.
If you directly choose "Classify by the first few characters", it might achieve a similar effect in some fixed-length scenarios; but regular expressions are more suitable for long-term reuse because they explicitly define "must be digits". If a file name does not start with three digits, it will not be mistakenly processed as a similar numbered category, which is more helpful for standardized organization.
Step 4: Keep case default, continue setting save location
On the same page below, you can see the "Letter case conversion" setting, with options including Default, Convert to Uppercase, Convert to Lowercase. Because what we are extracting is a numeric code, case does not affect the result, so keep Default.
After setting, click Next Step to enter "Set Save Location". The interface flow has clearly shown this step, which is used to specify where the files will be saved after batch classification. To facilitate checking the results, it is recommended to choose a clear output directory to avoid confusion with the original files. For important data, it is recommended to copy a sample set of files for testing before formal processing, and only process all files in batch after confirming the classification results are correct.
Step 5: Start processing and check classification results
After setting the save location, enter the "Start Processing" stage in the workflow. The software will read the file names one by one from the imported file list, use the regular expression to extract the classification value, then create the corresponding folder and move the file into it. After processing is complete, open the save directory, and you will see folders named 101, 102, and 103.
When checking the results, focus on two main points: first, do the folder names meet expectations; second, have all files under the same code entered the corresponding folder. If these are correct, it indicates that this rule can continue to be applied to more similar types of files. When encountering TXT, Word, Excel, or PDF files with the same naming convention in the future, they can also be batch archived using the same approach.
Rule Extension: How to adjust for different file naming patterns
The example in this article uses ^\d{3}, suitable for the situation where "the file name starts with three digits". If your file name prefix has a different length, you can adjust the number in the curly braces. For example, if the file name starts with a two-digit department code, you can use ^\d{2}; if it starts with a four-digit year or project number, you can use ^\d{4}.
If the file name does not start with digits but with letter codes, such as HR001.docx, FIN2026.xlsx, OPS-log.pdf, you need to set the expression according to the letter rules. The interface also provides options like classify by first English letter. Users can choose simpler built-in methods based on complexity, or continue using custom regular expressions. The principle is: the closer the rule fits the file name, the more accurate the classification result.
If the file name contains Chinese classifications, such as "财务-报销单-001.pdf" or "人事-合同-002.docx", you can first observe the delimiter and field position. If you just want to classify by the first few characters, you can consider the "Classify by the first few characters" option in the interface; if you need to match more complex segments, using a custom regular expression will be more flexible.
Frequently Asked Questions and Notes
1. Why not just manually create the 101, 102, 103 folders?
When there are only a dozen or so files, manual operation doesn't seem troublesome either. But the number of files in office scenarios often grows continuously, and classification rules are used repeatedly. The value of using a batch processing tool lies in saving the rule as an operational approach, reducing the time spent on repeated judgment and dragging each time, and also lowering the risk of mistakenly placing files in the wrong folder.
2. Will the regular expression affect the file content?
The operation in this article classifies by file name. The rule is used to extract a segment of characters from the file name as the classification basis, not to edit the file content. For docx, xlsx, PDF, txt, and other files, the classification basis is the file name itself. However, to be safe, it is still recommended to back up important data or test with samples before batch processing.
3. What if the file name does not start with three digits?
If some file names do not conform to the ^\d{3} rule, classification values like 101, 102, 103 cannot be extracted according to the rules in this article. Before processing, you should first unify the naming convention, or choose a classification method more suitable for the actual situation. For example, classify by the first English letter, classify by the first few characters, or classify by characters within a custom position range are all processing options visible in the interface.
4. What are some recommendations when processing a large number of files?
It is recommended to first verify the rules with a small number of files, and after confirming that the output directory and classification results are correct, then import a large batch of files. For files exported from business systems, it's best to keep the original naming unchanged so that rules can match stably. If there are spaces, special symbols, or inconsistent casing in file names, you should also confirm in advance whether these characters will affect the classification.
Summary: Replace manual dragging with rules for more stable office file archiving
Archiving files by name code is a very common office need. Through the example of TXT files starting with 101, 102, 103, this article demonstrated how to use "Classify Files by Name" in HeSoft Doc Batch Tool , and through Classify by Custom Regular Expression input ^\d{3}, automatically extract the first three digits of the file name and batch generate the corresponding folders.
The value of this method lies in its repeatability, scalability, and high efficiency. Whether you are organizing text logs, Word documents (docx), Excel spreadsheets (xlsx), PDF reports, or scanned images, as long as the file name contains a stable number or classification code, you can consider using the same approach for batch processing. It is recommended that you first select a small batch of files to test the rules, and after confirming correctness, process the full directory, turning file organization from manual labor into rule-based automatic archiving.