Many office files use fixed prefixes to indicate cities, clients, projects, or departments, such as LON, NYC, PAR, etc. If all files are piled into one folder, subsequent searching, packaging, and handover become inefficient. This article introduces using HeSoft Doc Batch Tool to batch classify files based on a specified number of characters at the beginning of the file name. The operation process includes selecting the file organization function, importing files, setting classification by the first few characters, specifying the quantity, setting the save location, and executing the process. This method is suitable not only for TXT but also for Word, Excel, PDF, images, and other file types.
Prefixes in filenames are a common naming convention used by many enterprises and individuals when managing data. For example, LON is used for London-related files, NYC for New York-related files, and PAR for Paris-related files; some also use client abbreviations, project codes, or department numbers as the beginning of filenames. Such a naming approach is quite standardized in itself, but if files are not archived in a timely manner afterward, dozens or hundreds of files can still pile up in the same directory. When you open the folder, you only see a long list of files, and search efficiency is not high.
If sorted manually, one needs to first determine the prefix of each filename, then create folders like LON, NYC, PAR, and drag the corresponding files into them. This is acceptable when there are few files, but errors easily occur when there are many. This article introduces a method more suitable for office scenarios: using HeSoft Doc Batch Tool to batch categorize many files together based on the very first characters in their filenames. It belongs to the batch file processing functions within office software, focusing not on changing file content but on helping users quickly complete file archiving, directory organizing, and data classification.
Applicable Scenarios: Most Suitable When Filename Beginnings Have a Pattern
Batch archiving by filename prefix is suitable when the beginning of filenames contains fixed classification information. Examples include city codes plus numbers, client abbreviations plus dates, project numbers plus document types, department codes plus monthly reports, etc. Whether the files are txt text files, doc documents, docx documents, xls spreadsheets, xlsx reports, ppt presentations, pdf contracts, images, or scans, as long as the classification basis is at the beginning of the filename, they can be processed by "classifying by the first few characters."
This type of function is especially suitable for the following tasks: finance personnel organizing invoices and reconciliation statements by company code; administrative staff organizing application forms and approval documents by department; operations staff archiving data export files by city or store; project assistants organizing proposals, quotations, contracts, and acceptance documents by project number; customer service staff organizing feedback records by customer ID. The core problem it solves is transforming repetitive, mechanical, and error-prone file moving actions into a single rule setting and batch execution.
Result Preview: From Mixed File List to Prefix-Grouped Folders
Before Processing: A Single Directory Contains Multiple Groups of Prefixed Files
In the pre-processing screenshot, the file list contains various prefixes, such as LON, NYC, PAR, SYD, TYO. Each filename is followed by a numerical ID, with the extension txt. Although these files already express their categories through their filenames, they are not sorted at the directory level; all files exist at the same level. For those who need to deliver by city, project, or client, this state requires secondary sorting.

After Processing: Prefixes Become Folder Names, Files Automatically Enter Corresponding Directories
The post-processing screenshot shows that the previously mixed files have been categorized into different folders, named LON, NYC, PAR, SYD, TYO respectively. This means the software recognized the first three characters of the filenames as the basis for classification and used these characters to create categorized directories. The processed result is clearer and more suitable for packaging, sharing, backup, and subsequent searches.

Operation Steps: Batch Categorizing Files by the First Characters of Filenames
Step One: Open the Categorize by Filename Function in File Organizing
After launching HeSoft Doc Batch Tool , first look at the left navigation bar. In the screenshot, "File Organizing" is in a selected state, and the right side displays multiple file organizing related functions. To achieve archiving by filename prefix, you need to click "Categorize Files by Filename". The description of this function is to batch categorize all files by filename, fitting the need in this article to group files with prefixes like LON, NYC, PAR together.
The expected result of this step is to enter a dedicated processing wizard, rather than manually operating in the file explorer. The software breaks down the complex task into stages: selecting files, setting rules, setting the save location, and starting the process, allowing the user to complete them in order.

Step Two: Import Files to be Archived and Verify the List
After entering the function page, the current function name "Categorize Files by Filename" is displayed at the top. The first stage of the process is "Select records to process". The upper right corner provides "Add Files" and "Import Files from Folder". If the files to be processed are scattered in different locations, you can use "Add Files" to select them in batches; if the files are already gathered in a single directory, using "Import Files from Folder" is more time-saving.
After importing, the table will list information like file name, path, extension, creation time, modification time, etc. In the screenshot example, the table already has records for LON10125384.txt, LON10181954.txt, NYC1010149.txt, PAR10213147.txt, etc., with the bottom showing a record count of 20. Verifying this list is very important because the software will later batch process the files in this list. If unrelated files are found, you can use the operation column to delete individual records, or clear and re-import.

Step Three: Choose to Categorize by the First Few Characters
After confirming the file list is correct, click the "Next" button at the bottom of the page. Upon entering the second stage, "Set Processing Options", you need to choose the appropriate rule under "Categorization Method". The categorization methods visible in the screenshot include: categorize by first character, by first digit, by first English letter, by first Chinese character, by the first few characters, by the last few characters, by characters within a custom position range, and by custom regular expression.
In this example, we want to archive by filename prefixes like LON, NYC, PAR, so "Categorize by the first few characters" should be selected. After selection, enter 3 in the "Number" field. This way, the software will extract the first 3 characters from each filename as the category name. The category for LON10125384.txt is LON, for NYC10235440.txt is NYC, and for TYO10378182.txt is TYO. Once set, the expected result is that the software will automatically create folders corresponding to these prefixes during subsequent processing.

Step Four: Set Letter Case as Needed
On the same settings page, you can also see the "Letter Case Conversion" area, with options including Default, Convert to Uppercase, Convert to Lowercase. For the filenames in the screenshot, the prefixes themselves are all uppercase, so keeping the default is fine. If your filenames contain a mix like abc001.pdf, ABC002.pdf, Abc003.pdf, and you want them all to go into the same ABC or abc folder, you can unify the case here.
While this setting does not always require adjustment, it is very useful when processing files exported by different people or from different systems. Because if the filename case is not unified, the system might generate multiple classification results that look similar but are actually different. Unifying the rules in advance makes the archiving result neater.
Step Five: Set the Save Location and Execute Batch Processing
Continue clicking "Next" to enter "Set Save Location". Although the screenshot does not show the specific input items on the save location page, it is clearly visible from the progress bar that this is the third stage of the processing wizard. It is recommended to save the processing results to a new directory, for example, creating a "Categorized" folder next to the original directory for easy distinction from the original files.
After the save location is set, enter the "Start Processing" stage. The software will automatically execute based on the imported file list and the previously set categorization method: read the first 3 characters of the filename, create a classification folder with the same name, and move the files into the corresponding folders. Once processing is complete, open the output directory to check the results; you should see folders like LON, NYC, PAR, SYD, TYO, with the files already stored centrally by prefix.
FAQ and Notes
What should I do if prefix lengths are inconsistent?
If all files have the first three characters as the category, like LON10125384.txt, entering 3 for the number is sufficient. If some files have two-character prefixes and some have three, it is advisable to first unify the filename rules or choose another categorization method based on the actual situation, such as categorizing by characters within a custom position range. The more stable the categorization rule, the more reliable the batch processing results.
Can this be used for Word and PDF files?
Yes. The screenshots in this article use txt files as an example because the sample files' extension is txt. However, categorizing by filename does not depend on the file content type. Word's doc, docx, Excel's xls, xlsx, PowerPoint's ppt, pptx, PDF's pdf, and common image files can all be archived by the first characters when the filename rules are consistent.
Do I need to backup before processing?
Backup is recommended. Any batch file operation can potentially affect a large number of files at once, especially when there are many files and complex paths. For safety, you can first make a copy of a test directory, confirm the categorization rules and save location meet expectations, and then process the official files. This way, even if the number is entered incorrectly, you can quickly revert.
Why didn't I get the expected folders after processing?
A common reason is that the number entered does not match the filename rule. For example, if the goal was to categorize by LON but you entered 2, you might get folders like LO, NY, PA; if you enter 4, you might get results like LON1, NYC1. Therefore, when setting the number, you need to clearly determine how many characters the prefix actually occupies first.
Summary: Letting Filename Prefixes Truly Deliver Archiving Value
Having prefixes in filenames is originally meant to make data easier to identify. After using HeSoft Doc Batch Tool , these prefixes can not only be understood by people but can also be used by the software to automatically create classification directories. For users who frequently organize office files like TXT, docx, xlsx, pdf, batch archiving by the first few characters of filenames can significantly reduce the time spent manually moving files.
If your folders also contain a large number of files named starting with clients, cities, departments, or projects, you can directly follow the procedure in this article: select "Categorize Files by Filename", import files, set "Categorize by the first few characters", fill in the corresponding number, set the save location, and start processing. One-time setup can complete batch archiving, making subsequent searching, statistics, and handovers much easier.