File content and file name batch processing method and device and storage medium
By employing batch processing methods and multi-threading technology, the problems of time-consuming, labor-intensive, and error-prone document content replacement and renaming processes have been solved, achieving efficient and accurate file content replacement and renaming.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU LUYI TECH CO LTD
- Filing Date
- 2025-12-24
- Publication Date
- 2026-05-19
AI Technical Summary
In existing technologies, the process of replacing document content and renaming documents relies on manual operation on a document-by-document and project-by-project basis, which is time-consuming, labor-intensive, and prone to errors.
This paper provides a batch processing method for file content and file name. By acquiring a batch of files to be processed, determining a preset keyword list and content replacement strategy, and combining it with a file naming strategy, a multi-threaded processing technique is used to perform batch linked file content replacement and file naming processing.
It enables synchronous processing of batch files, saving document processing time, improving processing efficiency and accuracy, and avoiding errors in manual operation.
Smart Images

Figure CN122064658A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document processing technology, and in particular to a method, apparatus, and storage medium for batch processing of document content and filenames. Background Technology
[0002] With the widespread adoption of digital office tools, businesses, universities, research institutions, and individual users daily need to process a large number of documents, covering various formats such as Word, Excel, PDF, and TXT, involving scenarios such as contract template modification, report number standardization, and file classification and organization. For example, when updating the names of partners, companies need to batch modify the client information in dozens of contracts; university teachers need to rename hundreds of documents in a uniform "Class-Name-Topic" format when organizing student assignments; and administrative staff need to replace the year identifiers in documents and rename the files when archiving annual reports. The increasing frequency of such batch operations directly impacts office efficiency and the standardization of document management.
[0003] Currently, document content replacement and document renaming are typically handled manually, document by document and project by project. However, this manual approach is time-consuming and labor-intensive, with lengthy processing times for both the main document and individual projects. Furthermore, staff negligence can lead to errors. Summary of the Invention
[0004] This invention provides a method, apparatus, and storage medium for batch processing of file content and filenames, mainly aimed at improving the processing efficiency and accuracy of file content and filenames.
[0005] According to a first aspect of the present invention, a method for batch processing of file content and filename is provided, comprising: Get a batch of files to be processed; A preset keyword list and content replacement strategy are determined for replacing the content of the batch of files to be processed, and a file naming strategy is determined for naming the batch of files to be processed. The preset keyword list includes the search content in the batch of files to be processed and the replacement content corresponding to the search content. Based on the number of files to be processed in the batch, the number of file processing threads is determined, and based on the preset keyword list, the content replacement strategy, and the file naming strategy, the corresponding number of file processing threads are invoked to perform batch-linked file content replacement and file naming processing on the batch of files to be processed.
[0006] Optionally, determining the content replacement strategy required for replacing the file content of the batch of files to be processed includes: Determine the filename suffix and header information of each file in the batch to be processed files, and determine the file format of each file in the batch to be processed files based on the filename suffix and header information; The process involves determining the content format of the content to be replaced in each file to be processed, determining the file content replacement format for the corresponding file based on the content format, determining the file processing engine for the corresponding file based on the file format, and determining the file content replacement range and file content replacement format for each file to be processed. Based on the file content replacement format, the file processing engine, the file content replacement range, and the file content replacement format, the content replacement strategy is determined. The method for determining the file content replacement format for the corresponding file to be processed based on the content format includes: If the content is text, then the fuzzy replacement form of the text content in the corresponding file to be processed is determined; if the content is formula, then the fine replacement form of the formula content in the corresponding file to be processed is determined; if the content is numeric, then the regularized replacement form of the numeric content in the corresponding file to be processed is determined.
[0007] Optionally, determining the file naming strategy required for naming the batch of files to be processed includes: Obtain the file content extraction location set by the client for the batch of files to be processed through the visual rule editor; The client obtains multiple file naming items selected by the client for the batch of files to be processed through a visual rule editor, wherein the file naming items include at least a file content extraction value item; The file content extraction location is associated with the file content extraction value item to obtain the associated file content extraction value item, and the positional order between the associated file content extraction value item and the remaining file naming items is determined. Based on the associated file content extraction value item with the positional order and the remaining file naming items, the file naming strategy is determined, wherein the remaining file naming items are each file naming item after removing the file content extraction value item.
[0008] Optionally, after calling a corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed, the method further includes: Determine if there are duplicate filenames in the named files. If so, obtain the file feature data, file storage feature data, file association item data, and user feature data of the client user who performed the file naming operation for each named file corresponding to the duplicate filename. Based on the file feature data, the file storage feature data, the file association item data, and the user feature data, the file name suffix of the corresponding named file is determined, and the new file name of the named file is formed by the civilization name of the corresponding named file and the file name suffix.
[0009] Optionally, before invoking the corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed, the method further includes: Based on the preset keyword list and the content replacement strategy, generate and display the file content replacement preview information for each file in the batch of files to be processed, and generate and display the file name preview information for each file in the batch of files to be processed based on the file naming strategy. Based on the displayed file content replacement preview information and file naming preview information, the predicted batch linkage processing effect of the batch of files to be processed is determined. If the predicted batch linkage processing effect does not meet the requirements, the preset keyword list, the content replacement strategy, and the file naming strategy are adjusted. The process of calling a corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed includes: Based on the adjusted preset keyword list, the adjusted content replacement strategy, and the adjusted file naming strategy, a corresponding number of file processing threads are invoked to perform batch-linked file content replacement and file naming processing on the batch of files to be processed.
[0010] Optionally, before invoking the corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed, the method further includes: In response to the batch linkage execution signal triggered by the client for the batch of pending files, a confirmation pop-up page is displayed. The confirmation pop-up page includes a confirmation control and information to be confirmed. The information to be confirmed includes the number of files in the batch of pending files, the preset keyword list, the content replacement strategy, the file naming strategy, and the file backup path. Based on the information to be confirmed, determine whether it is necessary to trigger the confirmation control. If so, in response to the trigger signal of the confirmation control, back up and store the batch of files to be processed.
[0011] Optionally, the method further includes: Record the processing operation information of the batch of files to be processed during the file content replacement and file naming process, generate and store the operation log based on the processing operation information, and generate a log download link for the stored operation log; In the batch of pending files, identify the files that are processing errors and the files that are processing successfully, determine the error type corresponding to the files that are processing errors, and generate a list of successful files corresponding to the files that are processing successfully and a list of error files corresponding to the files that are processing errors and their corresponding error types. Based on the log download link, the list of successful files, and the list of abnormal files, a processing result report is generated for the batch of files to be processed.
[0012] According to a second aspect of the present invention, a batch processing apparatus for file content and file name is provided, comprising: The acquisition unit is used to acquire a batch of files to be processed. The determining unit is used to determine a preset keyword list and content replacement strategy required to replace the file content of the batch of files to be processed, and to determine a file naming strategy required to name the batch of files to be processed, wherein the preset keyword list includes the search content in the batch of files to be processed and the replacement content corresponding to the search content; The linkage processing unit is used to determine the number of file processing threads based on the number of files to be processed in the batch, and to call the corresponding number of file processing threads to perform batch linkage file content replacement processing and file naming processing on the batch of files to be processed based on the preset keyword list, the content replacement strategy, and the file naming strategy.
[0013] According to a third aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned batch processing method for file content and file name.
[0014] According to a fourth aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-mentioned batch processing method for file content and file name.
[0015] According to the present invention, a method, apparatus, and storage medium for batch processing of file content and filenames are provided. Compared with the current method of manually processing documents one by one and project by project, the present invention obtains a batch of files to be processed; then determines a preset keyword list and content replacement strategy required for replacing the file content of the batch of files to be processed, and determines a file naming strategy required for naming the file content of the batch of files to be processed. The preset keyword list includes the search content and the replacement content corresponding to the search content in the batch of files to be processed; finally, based on the number of files in the batch of files to be processed, the number of file processing threads is determined, and based on the preset keyword list, the content replacement strategy, and the file naming strategy, the corresponding number of file processing threads are called to perform batch linked file content replacement processing and file naming processing on the batch of files to be processed. Therefore, by performing batch-linked file content replacement and file naming processing on a batch of files, the synchronous processing of file content replacement and file naming can be achieved, thereby saving document processing time and improving document processing efficiency. By using file processing threads to perform file content replacement and file naming, errors caused by manual processing can be avoided, thereby improving the accuracy of file content replacement and naming. Through multi-threaded collaborative file processing, file processing efficiency can be further improved. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 A flowchart of a batch processing method for file content and file name provided by an embodiment of the present invention is shown; Figure 2 A flowchart of another batch processing method for file content and file name provided by an embodiment of the present invention is shown; Figure 3 This diagram illustrates the structure of a batch processing device for file content and file name provided in an embodiment of the present invention. Figure 4 This diagram illustrates the structure of another batch processing device for file content and filenames provided in an embodiment of the present invention. Figure 5 A schematic diagram of the physical structure of a computer device provided in an embodiment of the present invention is shown. Detailed Implementation
[0017] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the present application can be combined with each other.
[0018] Currently, document content replacement and document naming are usually handled manually, one document at a time, one project at a time. This is time-consuming and labor-intensive, and errors can occur due to staff negligence.
[0019] To address the aforementioned problems, embodiments of the present invention provide a method for batch processing of file content and filenames, such as... Figure 1 As shown, the method includes: 101. Obtain a batch of files to be processed.
[0020] The batch processing of files can be a large number of files of different formats, of the same type, or of different types; different formats include Word, Excel, PDF, TXT, etc.; types include but are not limited to contracts, student assignments, annual reports, etc.
[0021] Specifically, this invention embodiment utilizes a batch linked file processing system to achieve batch file content replacement and file renaming. The system adopts a C / S architecture (client + local server). The client handles user interaction (interface operation, parameter settings, preview), while the local server handles file parsing, batch processing, and data encryption, avoiding reliance on cloud servers and ensuring processing speed and data security. It supports both Windows and macOS systems, adapting to different office devices. On the client, the user selects a folder, and the system automatically scans all documents in the folder with supported formats and uploads them to the system for file processing. Alternatively, the user can drag and drop files into the system's tool interface, or import a list of file paths (Excel / TXT format, containing absolute paths of multiple files). The system automatically retrieves the batch files to be processed based on the file path list. The batch linked file processing system in this invention embodiment can achieve "content replacement + file renaming" linked operations: this tool integrates "batch document content replacement" and "batch file renaming" functions into the same interface, supporting the completion of both operations at once. For example, the tool can be set to "replace 'old company name' with 'new company name' in the document" and simultaneously replace "old company name" with "new company name" in the file name without switching tools. It also ensures the accuracy of the content and file name matching through unique file identifiers (such as file path and hash value) to avoid operational errors.
[0022] 102. Determine the preset keyword list and content replacement strategy required for replacing the content of a batch of files to be processed, and determine the file naming strategy required for naming the batch of files to be processed. The preset keyword list contains the search content and the corresponding replacement content in the batch of files to be processed.
[0023] In this embodiment of the invention, the user clicks the "Import Keyword List" button on the tool interface of the batch linked file processing system to upload a preset keyword list in a set format (such as Excel, TXT, etc.). The first column of the preset keyword list is "Find Content," and the second column is "Replace Content." The tool automatically parses and displays the keyword list, supporting users to edit, delete, and sort the preset keyword list. Simultaneously, the file format (such as Word, Excel, PDF, TXT, PPT, etc.) and content format (text, formula, image, etc.) of the batch files to be processed are determined, and corresponding content replacement strategies are matched for different file formats and content formats. For example, an OCR recognition + precise replacement strategy is used for text content in PDFs; a strategy that preserves the format and replaces only the text parameters for formula content in Excels is adopted; and a strategy that supports batch replacement of image files for image watermarks in Words is implemented. The file processing method implemented in this invention solves the problem of single format adaptation in existing tools and meets the needs of multi-scenario office work. This invention provides clear rules and guidelines for file content replacement by defining a preset keyword list, clarifying the search content and corresponding replacement content in batches of files to be processed. This avoids omissions and erroneous replacements that may occur during manual replacement, ensuring the accuracy and consistency of the replacement operation. The content replacement strategy can take into account various complex replacement situations, such as partial matching and conditional replacement. Selecting an appropriate replacement strategy based on different file content and requirements can better meet actual application scenarios and further improve the quality and accuracy of content replacement.
[0024] Furthermore, the batch file processing system provides a visual rule editor, allowing users to combine naming strategies by dragging and dropping components such as "prefix," "date (YYYY-MM-DD)," "serial number (001-999)," and "extracted document content value," for example, "Contract - YYYY-MM-DD - Customer Number - Serial Number." The "extracted document content value" allows users to set extraction rules (such as "extract text from the first line of the first paragraph on page 1 of a Word document" or "extract content from the first cell in the first row of the first column of an Excel file"). This embodiment of the invention uses a defined file naming strategy to uniformly name batch files, giving filenames a clear pattern and meaning. Furthermore, by adhering to the naming strategy, it ensures standardized and effective file naming.
[0025] Furthermore, after determining the preset keyword list, content replacement strategy, and file naming strategy, in order to ensure the processing effect of the files, it is first necessary to determine the preview processing information based on the preset keyword list, content replacement strategy, and file naming strategy. Based on this, the method includes: generating and displaying the file content replacement preview information for each file in the batch of files to be processed, based on the preset keyword list and the content replacement strategy; and generating and displaying the file naming preview information for each file in the batch of files to be processed, based on the file naming strategy; determining the predicted batch linkage processing effect of the batch of files to be processed based on the displayed file content replacement preview information and file naming preview information; and adjusting the preset keyword list, the content replacement strategy, and the file naming strategy if the predicted batch linkage processing effect does not meet the requirements.
[0026] Specifically, the process iterates through a batch of files to be processed. For each file, a simulated content replacement operation is performed according to a preset keyword list and content replacement strategy. During the simulation, the location of each search term and the replaced content are recorded, forming a file content replacement preview. For example, for a document, the preview might show "Found 'old product name' in paragraph 3, line 2, will be replaced with 'new product name'". The generated file content replacement preview is then displayed to the user in an intuitive way, perhaps in a list format with one record for each file, detailing the replacement details. Users can view the replacement preview for each file through the interface to understand the specific content and location of the replacement. Simultaneously, based on the file naming strategy, a new filename preview is generated for each file in the batch of files to be processed. During generation, file attribute information (such as file type, creation date, etc.) and preset naming elements are combined according to the strategy rules. For example, for a market analysis report created on October 10, 2024, the preview filename generated according to the above naming strategy might be "Marketing Project_20241010_Report_001". Displaying the generated file naming preview information along with the file content replacement preview information to the user can also be done in a list format, allowing users to clearly see the original name and the new preview name of each file. This allows users to view the "original content - modified content" and "original filename - modified filename" comparison previews for each file before performing batch operations, confirming accuracy before proceeding, thus reducing error rates. Afterwards, users comprehensively evaluate the batch processing effect based on the displayed file content replacement preview information and file naming preview information. Evaluation indicators can include the accuracy of content replacement, the standardization and readability of file naming, and whether it meets business needs. For example, users check the content replacement preview information to confirm that all content to be replaced is displayed correctly and that the replaced content meets expectations; simultaneously, they check the file naming preview information to determine whether the new filename accurately reflects the file's content and attributes, facilitating subsequent management and use. Finally, if the predicted batch processing effect does not meet the requirements, adjustments can be made to the preset keyword list, content replacement strategy, and file naming strategy. For example, adjusting the preset keyword list: based on issues identified in the preview information, add, delete, or modify the search and replacement content in the preset keyword list. If some content does not need to be replaced or is missing, corresponding adjustments can be made to the preset keyword list. Adjusting the content replacement strategy: according to actual needs, adjust the content replacement rules, such as changing the matching method or replacement range. For example, if it was originally full-word matching, it can now be adjusted to partial matching to meet different replacement requirements.Adjusting the file naming strategy: Elements and formats within the file naming strategy can be modified to better suit actual usage scenarios. For example, the generation method of serial numbers can be adjusted, or more file attribute information can be added to the filenames. Finally, the adjusted preset keyword list, content replacement strategy, and file naming strategy are used to perform batch-linked content replacement and file naming. This achieves simultaneous processing of file content replacement and file naming. The preview results are updated in real-time after adjustments until the final preview results meet the actual requirements. This embodiment of the invention, by displaying file content replacement preview information and file naming preview information, allows for a visual understanding of potential changes to each file before actual batch processing, thereby identifying and resolving potential problems in advance and ensuring the accuracy of the final processing results. Simultaneously, displaying the preview information in an intuitive way clearly shows the changes that batch processing will bring, making problem handling more visual and clear, thus facilitating subsequent problem processing.
[0027] 103. Based on the number of files to be processed in a batch, determine the number of file processing threads, and based on the preset keyword list, content replacement strategy, and file naming strategy, call the corresponding number of file processing threads to perform batch linked file content replacement and file naming processing on the batch of files to be processed.
[0028] In this embodiment of the invention, the number of processing threads can be determined based on the number of files to be processed and the number of system CPU cores. Based on this number, a corresponding number of idle processing threads are scheduled from the thread pool, and these idle threads simultaneously perform file content replacement and file naming operations on a batch of files in parallel. Meanwhile, the client interface displays the file processing progress in real time (e.g., "30 / 100 files completed, progress 30%)" and marks abnormal files (e.g., "File A format not supported, skip processing" "File B insufficient permissions, processing failed"). This embodiment of the invention, by performing batch-linked file content replacement and file naming processing on a batch of files, can achieve synchronous processing of file content replacement and file naming for a batch of files, thereby saving document processing time and improving document processing efficiency. This embodiment of the invention dynamically determines the number of processing threads based on the number of files, adapting to file processing tasks of different scales. Whether it's a small number of files or a massive number of files, the system can reasonably allocate resources to ensure the smooth progress of processing tasks, improving the system's adaptability and flexibility. This embodiment of the invention further improves file processing efficiency through multi-threaded collaborative file processing.
[0029] In another embodiment of the present invention, in order to facilitate the tracking of subsequent file processing, it is also necessary to generate a file processing result report. Based on this, the method includes: recording the processing operation information of the batch of files to be processed during the file content replacement and file naming process; generating and storing the operation log based on the processing operation information; generating a log download link for the stored operation log; identifying abnormal files and successful files among the batch of files to be processed, determining the exception type corresponding to the abnormal files, and generating a list of successful files corresponding to the successful files and a list of abnormal files corresponding to the abnormal files and their corresponding exception types; generating a processing result report for the batch of files to be processed based on the log download link, the list of successful files, and the list of abnormal files.
[0030] Specifically, during the batch processing of files for content replacement and file renaming, the system records information for each step of the processing operation in real time. For content replacement operations, the recorded information includes, but is not limited to: the processor, processing time, the name of the file to be processed, the original location of the search content, the search content, the replacement content, the timestamp of the replacement operation, and the thread number that executed the replacement operation. For example, when processing the file "Project Report.docx", the system records: "The search content 'old technical terminology' was found in the second line of the third paragraph of 'Project Report.docx', and it was replaced with 'new technical terminology'. The replacement time was 2024-10-15 14:30:22, and the execution thread was thread 3." For file renaming operations, the recorded information includes: the original filename, the new filename, the naming strategy used, and the timestamp of the naming operation. For example, the system records: "The original file 'data.txt' was renamed to 'PRJ20241015_data.txt' according to the naming strategy '[Project Number][Date][File Type]', and the naming time was 2024-10-15 14:31:10." The recorded processing information is organized and packaged according to a specific format (such as JSON, XML, etc.) to generate an operation log file. Then, the generated operation log file is stored in a specified storage location, which can be a specific directory on the local disk or a cloud storage service. For example, the operation log can be stored in JSON format in the local directory "D:\file_processing_logs\", and the filename can be named according to the rule "processing task number_operation log_date.json". If the operation log is stored in a cloud storage service, a corresponding log download link is generated using the API provided by the cloud storage; if it is stored locally, a web service can be set up to map the local log file to a downloadable link. Users can use the "Log Query" function to filter logs by time, operation type (content replacement / file naming / content replacement-file naming), and file format, and click on log entries to view detailed information in the logs.
[0031] Furthermore, after file processing is complete, the system determines whether each file was processed successfully or abnormally based on the feedback information. For example, if issues arise during file content replacement such as the inability to find the search content, the file format not supporting the replacement operation, or file naming issues such as filename conflicts or non-compliance with naming rules, the file is marked as an abnormal file. Conversely, if the file successfully completes content replacement and naming operations, it is marked as a successful file. For abnormal files, the system further analyzes and determines their corresponding exception type. Common exception types can include: content replacement exceptions (such as the search content not existing, replacement failure, etc.), file naming exceptions (such as duplicate filenames, incorrect naming rules, etc.), and file access exceptions (such as the file being occupied, lack of read permissions, etc.). For example, when the system detects that the file cannot be written to because it is occupied by another program while replacing file content, the exception type for that file is determined to be "file access exception - file being occupied". Successfully processed files are organized in a certain order (such as ascending filename order) to generate a list of successful files, which may include information such as filename, original file storage path, and new file storage path. Similarly, the system compiles a list of abnormal files and their corresponding exception types, clearly labeling each file with its specific exception type in addition to its filename. Based on the generated log download links, the list of successful files, and the list of abnormal files, the system integrates this information to generate a processing result report. This report can be in HTML, PDF, or other formats for user viewing and sharing.
[0032] According to the present invention, a batch processing method for file content and filenames is provided. Compared with the current manual document processing method that processes documents one by one and project by project, the present invention obtains a batch of files to be processed; then determines a preset keyword list and content replacement strategy required for replacing the file content of the batch of files to be processed, and determines a file naming strategy required for naming the file content of the batch of files to be processed. The preset keyword list contains the search content and the corresponding replacement content in the batch of files to be processed; finally, based on the number of files in the batch of files to be processed, the number of file processing threads is determined, and based on the preset keyword list, the content replacement strategy, and the file naming strategy, the corresponding number of file processing threads are called to perform batch-linked file content replacement and file naming processing on the batch of files to be processed. Therefore, by performing batch-linked file content replacement and file naming processing on a batch of files, it is possible to achieve synchronous processing of file content replacement and file naming, thereby saving document processing time and improving document processing efficiency. By using file processing threads to perform file content replacement and file naming, errors caused by manual processing can be avoided, thereby improving the accuracy of file content replacement and naming. Through multi-threaded collaborative file processing, file processing efficiency can be further improved.
[0033] Furthermore, to better illustrate the above process of batch processing file content and filenames, as a refinement and extension of the above embodiments, this embodiment of the invention provides another method for batch processing file content and filenames, such as... Figure 2 As shown, the method includes: 201. Obtain a batch of files to be processed.
[0034] Specifically, files to be processed can be uploaded via the client, or a file path can be uploaded, and the system will actively retrieve the files based on the file path.
[0035] 202. Determine the preset keyword list and content replacement strategy required for replacing the content of a batch of files to be processed, and determine the file naming strategy required for naming the batch of files to be processed. The preset keyword list contains the search content and the corresponding replacement content in the batch of files to be processed.
[0036] In this embodiment of the invention, to ensure the standardization and efficiency of content replacement when replacing content in the files to be processed, a content replacement strategy needs to be determined in advance. Therefore, step 202 specifically includes: determining the filename suffix and header information of each file to be processed in the batch of files to be processed; determining the file format of each file to be processed in the batch of files to be processed based on the filename suffix and header information; determining the content format of the content to be replaced in each file to be processed; determining the file content replacement format of the corresponding file to be processed based on the content format; determining the file processing engine of the corresponding file to be processed based on the file format; determining the file content replacement range and file content replacement format of each file to be processed; and determining the content replacement strategy based on the file content replacement format, the file processing engine, the file content replacement range, and the file content replacement format. The method for determining the file content replacement format of the corresponding file to be processed based on the content format includes: if the content format is text content, determining a fuzzy replacement format for the text content of the corresponding file to be processed; if the content format is formula content, determining a fine replacement format for the formula content of the corresponding file to be processed; and if the content format is numerical content, determining a regularized replacement format for the numerical content of the corresponding file to be processed.
[0037] The content formats include text, formulas, numbers, and images, each with its own content replacement method. For example, text content uses fuzzy replacement; Excel formulas retain their formatting while replacing only the text parameters; and Word images with watermarks can be replaced in batches. Different file formats use different processing engines, such as the Word engine, PDF engine, and Excel engine.
[0038] Specifically, the format recognition module automatically detects the format of each file. For example, it makes an initial judgment based on the file name extension (such as ".docx", ".pdf", ".jpg", etc.), and then performs a secondary verification using the file header information (the file header is usually located at the beginning of the file and contains key information to identify the file type and format. This header information can be obtained by reading the first few bytes of the file. For example, for PDF files, the header usually starts with "%PDF-") to avoid recognition errors caused by file name extension tampering. The obtained file name extension and header information are matched against a pre-established file format feature library, which stores file name extensions and corresponding header features for various common file types. For example, for a ".docx" file, its header features may include specific XML identifiers. Through matching, the file format of each file to be processed is accurately determined. For example, a file with a file name extension of ".docx" and a header that conforms to the characteristics of a Word document is identified as a Microsoft Word document.
[0039] Furthermore, a detailed analysis is performed on the content to be replaced in each file to determine its format. This can be achieved through natural language processing techniques and specific format parsing methods. For example, for text files, text analysis algorithms can be used to determine whether the content is ordinary text, formula text, or numerical text. If the content to be replaced is text, a fuzzy replacement format is determined for the corresponding file. Fuzzy replacement allows for a certain degree of approximate matching; for example, a similarity threshold can be set, and replacement is performed when the search content and the content in the file have a certain similarity. For example, if the search content is "apple," and the file contains similar words such as "apples" and "aple," they can all be replaced with the specified content, such as "orange," if the similarity threshold is met. If the content is formula content, a fine-grained replacement format is determined. Precise matching and replacement are performed for specific symbols and variables in the formula. For example, in the mathematical formula "E = mc²," if "c" needs to be replaced with "v," a precise replacement is performed to ensure the accuracy and completeness of the formula. If the content is numerical content, a regularized replacement format is determined. Regular expressions are used to match and replace numbers that conform to specific patterns. For example, for numerical formats such as phone numbers and dates, corresponding regular expressions can be written for replacement. For instance, the phone number "138 - 1234 - 5678" can be replaced with "13812345678".
[0040] Furthermore, different file formats require different processing engines for content replacement. Based on the previously determined file formats (Word, PDF, Excel, etc.), a suitable engine is selected from a pre-configured file processing engine library. For example, for Microsoft Word documents (.docx format), open-source libraries such as Apache POI (Java environment) or python-docx (Python environment) can be used as processing engines; for PDF files, libraries such as iText and PyPDF2 can be used. Simultaneously, the content replacement scope for each file to be processed is determined according to actual needs. This can be the entire file content, or specific chapters, paragraphs, cells (for table files), etc. For example, when processing a document containing multiple chapters, if only specific content in a certain chapter needs to be replaced, the replacement scope is limited to that chapter. At the same time, the format of the replaced content is determined, including font, font size, color, and layout. For example, when replacing text content, you can specify a particular font (such as SimSun), font size (such as 12pt), and color (such as red) for the replaced text to maintain file format consistency or highlight the replaced content. Additionally, you can choose to automatically preserve the original formatting during replacement; for example, replacing "old company name (bold)" with "new company name" will still retain its boldness. If the user needs to modify the format, they can additionally check "Apply formatting after replacement" and set parameters such as font and color. Finally, the previously determined file content replacement format, file processing engine, file content replacement range, and file content replacement format are used to formulate a detailed content replacement strategy for each file to be processed. This strategy is stored in a structured data format, such as JSON, for easy retrieval and execution during subsequent file processing.
[0041] Furthermore, to ensure the standardization and efficiency of naming the files to be processed, a file naming strategy needs to be determined in advance. Based on this, step 202 specifically includes: obtaining the file content extraction positions set by the client for the batch of files to be processed through the visual rule editor; obtaining multiple file naming items selected by the client for the batch of files to be processed through the visual rule editor, wherein the file naming items include at least a file content extraction value item; associating the file content extraction positions with the file content extraction value items to obtain associated file content extraction value items, and determining the positional order between the associated file content extraction value items and the remaining file naming items; and determining the file naming strategy based on the associated file content extraction value items with the positional order and the remaining file naming items, wherein the remaining file naming items are each file naming item after removing the file content extraction value items.
[0042] The file content extraction location is specified, such as "extracting text from the first line of the first paragraph on the first page of a Word document" or "extracting the content of the first cell in the first row of the first column of an Excel file". The file naming items include, but are not limited to, prefix, date, serial number, and extracted document content values.
[0043] Specifically, client users use a visual rule editor to specify the locations for extracting content from a batch of files. The visual rule editor provides an intuitive graphical interface, allowing users to mark the locations of content to be extracted in the file content display area using mouse clicks and drags. For example, when processing a batch of contract documents, a user might want to extract the contract numbers. In the visual rule editor, the user can select the paragraph or line containing the contract number on the contract document display interface, and the system will record the coordinates or text node information of that location as the file content extraction location. Client users also select multiple file naming items in the visual rule editor. File naming items can include file creation date, project name, file type, and file content extraction values. For example, when processing marketing report files, the user might select file naming items such as "Marketing Project," "Report," and "File Content Extraction Values (such as Key Data Indicators)." Since the file naming items include file content extraction values, the system needs to associate the previously obtained file content extraction locations with these values. Specifically, the system binds the corresponding file content extraction location information to the file content extraction value items based on the file identifier. For example, for the file "Contract1.pdf", the extracted content location points to the text node containing the contract number. This location information is associated with the "Contract Number Extraction Value" item in the file naming field, forming an associated file content extraction value item. Client users can sort the associated file content extraction value items and the remaining file naming items in the visual rule editor. The visual rule editor provides functions such as moving up and down and dragging to sort, allowing users to adjust the order of these items according to their needs. For example, if a user wants the file naming format to be "Project Name_Contract Number Extraction Value_File Type", then in the editor, "Project Name", "Associated Contract Number Extraction Value Item", and "File Type" will be arranged in this order. The system will record the order information set by the user. Based on the associated file content extraction value items and the remaining file naming items with their positional order, the system determines the file naming strategy. The file naming strategy can exist in the form of a rule expression or a configuration file. For example, the rule expression "[Project Name][Contract Number Extraction Value][File Type]" can be used to represent the file naming rule. When processing a batch of files, the system generates a new filename for each file based on this strategy, combined with the content values extracted from the files and the preset naming item values. For example, for "Contract1.pdf", assuming the project name is "ABC Project", the extracted contract number is "HT20241001", and the file type is "PDF", the generated new file name will be "ABC Project_HT20241001_PDF".
[0044] 203. Based on the number of files to be processed in a batch, determine the number of file processing threads, and based on the preset keyword list, content replacement strategy, and file naming strategy, call the corresponding number of file processing threads to perform batch linked file content replacement and file naming processing on the batch of files to be processed.
[0045] Before performing batch processing on files, it is necessary to confirm the preset keyword list, the content replacement strategy, and the file naming strategy to determine whether the file processing flow needs to be executed. Based on this, the method includes: in response to a batch execution signal triggered by the client for the batch of files to be processed, displaying a confirmation pop-up page, wherein the confirmation pop-up page includes a confirmation control and information to be confirmed, wherein the information to be confirmed includes the number of files to be processed in the batch, the preset keyword list, the content replacement strategy, the file naming strategy, and the file backup path; based on the information to be confirmed, determining whether it is necessary to trigger the confirmation control; if so, in response to the trigger signal of the confirmation control, backing up and storing the batch of files to be processed.
[0046] Specifically, the client triggers batch execution signals through specific interface elements, such as buttons and menu options. For example, in a file processing software, there is a "Batch Processing" button; clicking this button triggers a batch execution signal. After receiving the batch execution signal triggered by the client, the system begins collecting confirmation information. Based on the collected information, the system generates a confirmation pop-up page and displays it to the user. The confirmation pop-up page can be built using HTML, CSS, and JavaScript technologies (in web applications) or using a UI framework provided by the operating system (such as WinForms for Windows or Cocoa for macOS) (in desktop applications). The pop-up page contains confirmation controls (such as buttons) and an area displaying the confirmation information. The user reviews the confirmation information in the pop-up page and decides whether to trigger the confirmation control. If the user believes the information is correct and agrees to proceed with the subsequent file processing and backup operations, they click the confirmation control; if the user finds the information incorrect or does not wish to proceed, they do not click the confirmation control and can close the pop-up page. If the user triggers the confirmation control, the system receives the trigger signal. In web applications, button click events can be listened to using JavaScript, and confirmation signals can be sent to the backend server via Ajax or similar methods. In desktop applications, button click events can be received using an event listener mechanism. The system backs up and stores a batch of files to be processed based on the previously obtained file backup paths. File copy operations can be used to copy files from their original locations to the locations specified in the backup paths. Through these specific implementation methods, when a batch execution signal is triggered on the client side, key information can be displayed to the user and user confirmation can be obtained, ensuring that a batch of files to be processed are backed up and stored with the user's consent, thus improving the security and controllability of the operation. Furthermore, the processing and storage processes of the files to be processed in this embodiment of the invention are both encrypted. For example, when processing files, the AES-256 encryption algorithm is used to protect the document content; if file synchronization to the cloud is required (such as cross-device operation), HTTPS protocol is used for transmission to prevent data leakage.
[0047] Finally, if it is determined that batch processing of files is required, the system obtains the total number of files to be processed through file system interfaces or database queries. A base number of threads and a threshold for the number of files each thread can process are set. For example, the base number of threads is 4, and each thread can process a maximum of 10 files. If the total number of files is 35, the number of threads is calculated as 4, with 3 threads each processing 10 files and 1 thread processing 5 files. Furthermore, the current resource usage of the system is considered, such as the number of CPU cores and memory size. For example, if the system has 8 CPU cores, the number of threads can be initially set to not exceed the number of CPU cores. Simultaneously, the processing time for each file is dynamically adjusted based on the estimated processing time (which can be estimated through factors such as file size and content complexity). If the file sizes vary significantly, more resources can be allocated to larger files or a separate thread can be assigned to process them to ensure overall processing efficiency. Assuming the system has 8 CPU cores and a total of 20 files, with 5 large files expected to take longer to process, these 5 large files can be distributed among 5 threads. The remaining 15 smaller files can be evenly distributed among the other 3 threads, for a total of 8 threads. Based on the previously determined number of threads, create the corresponding number of file processing threads. Each thread, upon initialization, loads resources such as a preset keyword list, content replacement strategy, and file naming strategy. Distribute the batch of files to be processed evenly or according to dynamic load balancing principles to the threads. The specific processing steps for each thread's assigned files are as follows: File content replacement processing: Open the file according to the file processing engine specified in the content replacement strategy. For example, if the processing engine is python-docx, then use this library to open the Word document. Traverse the file content, searching for the content to be replaced according to the preset keyword list. If the content replacement is fuzzy text replacement, use the corresponding similarity matching algorithm (such as cosine similarity) to find approximate content; if it is fine-grained replacement of formula content or regularized replacement of numerical content, use exact matching and regular expression matching respectively. Replace the found content according to the replacement range and replacement format in the content replacement strategy. For example, within a specific paragraph, matched text is replaced with new text in a specified format. File naming processing: Based on the associated file content extraction value item in the file naming strategy, the corresponding content value is extracted from the file. For example, if the associated item is the contract number extraction value, the contract number is extracted from the contract file. Following the positional order determined in the naming strategy, the extracted content values are combined with the remaining file naming items to form a new filename. For example, based on the order of "Project Name_Contract Number Extraction Value_File Type", "ABC Project", the extracted contract number "HT20241001", and the file type "Word Document" are combined to form the new filename "ABC Project_HT20241001_Word Document", and then the file is renamed using the new filename.The content replacement and renaming processes for each of the above files are performed synchronously.
[0048] 204. Determine if there are duplicate filenames in the named files. If so, obtain the file feature data, file storage feature data, file association item data, and user feature data of the client user who performed the file naming operation for each named file corresponding to the duplicate filename.
[0049] 205. Based on file feature data, file storage feature data, file association item data, and user feature data, determine the file name suffix of the corresponding named file, and construct a new file name for the named file by combining the original name of the corresponding named file and the file name suffix.
[0050] The file feature data includes file type, file content keywords, content summary, etc.; file storage feature data refers to the file storage path; file association project data refers to a project, transaction, business unit, or theme with which the files are logically related. For example, if a company signs different contracts with multiple clients, each contract will generate contract text, supplementary agreements, correspondence, etc. In this case, the cooperation project corresponding to each client is the file association project, such as "the cooperation project with Company A". All contract-related documents of this project are associated with it; user feature data refers to the user's historical naming preference information, such as the naming style commonly used by the user for specific types of files and the types of suffixes added.
[0051] In this embodiment of the invention, the method for determining the filename suffix of a corresponding named file based on file feature data, file storage feature data, file association item data, and user feature data includes: determining the file feature vector corresponding to the file feature data, the storage feature vector corresponding to the file storage feature data, the association feature vector corresponding to the file association item data, and the user feature vector corresponding to the user feature data; performing feature-level superposition processing on the file feature vector, the storage feature vector, the association feature vector, and the user feature vector to obtain a feature superposition vector; performing element-level superposition processing on the file feature vector, the storage feature vector, the association feature vector, and the user feature vector to obtain an element superposition vector; performing low-order superposition processing on the file feature vector, the storage feature vector, the association feature vector, and the user feature vector to obtain a low-order superposition vector; performing transformation processing on the feature superposition vector, the element superposition vector, and the low-order superposition vector to obtain a filename suffix superposition feature vector; and inputting the filename suffix superposition feature vector into a preset filename suffix prediction model to predict the filename suffix, thereby obtaining the filename suffix corresponding to files with duplicate filenames.
[0052] In this embodiment of the invention, a preset filename suffix prediction model is pre-trained and constructed. The construction method includes: constructing a preset initial filename suffix prediction model; obtaining a sample dataset, wherein the sample dataset includes file feature data, file storage feature data, file association item data, and user feature data of sample files with filename suffix tags; dividing the sample dataset into a training set and a test set; training the preset initial filename suffix prediction model using the training set; and testing the trained preset initial filename suffix prediction model using the test set; finally, the preset initial filename suffix prediction model that meets the test conditions is used as the preset filename suffix prediction model. Specifically, in the model training process, the preset initial filename suffix prediction model is first constructed, and then the sample dataset is obtained. It is ensured that the dataset contains all necessary files. The data is converted to a format that the preset initial filename suffix prediction model can understand, and finally, the model is trained and tested. Specifically, the dataset can be divided first: the sample dataset is divided into a training set and a test set using random or specific strategies (such as stratified sampling). Then, the model is trained using the training set, and the trained model is tested using the test set to evaluate its performance on unseen data. Calculate and record metrics such as precision and recall on the test set. If the model performance does not meet the requirements, return to the training phase for further iterations or adjustments. This will yield a preset filename suffix prediction model that meets the requirements.
[0053] Furthermore, feature extraction models (such as CNN models) are used to extract feature vectors corresponding to file feature data, file storage feature data, file association item data, and user feature data, respectively. If the file feature vector is (a1, a2), the storage feature vector is (b1, b2), the association feature vector is (c1, c2), and the user feature vector is (d1, d2), the specific combination processing method includes: superimposing the feature dimensions between different feature vectors, that is, after performing a Hadamard product on all elements of the vectors, a convolution transformation is performed under a certain weight w1 to obtain the feature superimposed vector f(w1×(a1×b1×c1×d1, a2×b2×c2×d2)); simultaneously, element-level combination is performed on all feature vector data, that is, after performing a Hadamard product on each element (component) of the vectors, different weight values are assigned to each product result, and then a linear transformation is performed to obtain the element superimposed vector f(w2×a1×b1×c1×d1, w3× (a2×b2×c2×d2); In addition, all feature vectors are subjected to low-order superposition processing, and then weight coefficients are assigned to the superposition result. Then, a linear transformation is performed to obtain the low-order superposition vector f(w4(a1,a2,b1,b2,c1,c2,d1,d2)); Finally, the above feature superposition vector, element superposition vector, and low-order superposition vector are combined using a preset transformation function, such as horizontal concatenation, to obtain the file name suffix superposition feature vector. It should be noted that the above examples are only illustrative and do not limit the embodiments of this application. Thus, by superimposing file feature vectors, storage feature vectors, association feature vectors, and user feature vectors, different features can be automatically or explicitly combined to generate new feature combinations. These combined features may contain complex nonlinear relationships between the original features, enabling the model to capture more refined and richer information in the data. That is, it can make full use of the relationships between various data, extract more latent features, make data utilization more efficient, and the subsequent model prediction results are more accurate, meeting the needs of practical application scenarios. Finally, the filename suffix superimposed feature vector is directly input into a pre-defined filename suffix prediction model. This model directly predicts the filename suffixes of files with duplicate filenames. The filename suffix is then appended to the corresponding filename to form a new filename. This process avoids duplicate filenames.
[0054] In another embodiment of the present invention, if there are duplicate filenames, you can also choose "serial number increment" (if the generated new filename is duplicate, a serial number will be automatically added to the end, such as "Contract-20240101-A001" "Contract-20240101-A002") or "overwrite prompt" (if the filename is duplicate, a pop-up window will prompt the user to choose "overwrite", "skip" or "rename".
[0055] In another embodiment of the present invention, during file processing, users can customize parameters such as "default backup path," "default naming rules," "maximum number of threads," and "encrypted backup enabled" in the settings interface of the batch file processing system. The system saves the configuration information and automatically loads it upon the next startup. Format conversion compatibility: For some special format files (such as WPS format doc and xls), the system integrates a format conversion plugin to automatically convert them to compatible formats (such as standard Word and Excel formats) before processing. After processing, users can choose to "keep the converted format" or "restore to the original format."
[0056] According to another method for batch processing of file content and filenames provided by the present invention, compared with the current method of manually processing documents one by one and project by project, the present invention obtains a batch of files to be processed; then determines a preset keyword list and content replacement strategy required for replacing the file content of the batch of files to be processed, and determines a file naming strategy required for naming the file content of the batch of files to be processed, wherein the preset keyword list contains the search content and the replacement content corresponding to the search content in the batch of files to be processed; finally, based on the number of files in the batch of files to be processed, the number of file processing threads is determined, and based on the preset keyword list, the content replacement strategy, and the file naming strategy, the corresponding number of file processing threads are called to perform batch linked file content replacement processing and file naming processing on the batch of files to be processed. Therefore, by performing batch-linked file content replacement and file naming processing on a batch of files, it is possible to achieve synchronous processing of file content replacement and file naming, thereby saving document processing time and improving document processing efficiency. By using file processing threads to perform file content replacement and file naming, errors caused by manual processing can be avoided, thereby improving the accuracy of file content replacement and naming. Through multi-threaded collaborative file processing, file processing efficiency can be further improved.
[0057] Furthermore, as Figure 1 In specific implementation, embodiments of the present invention provide a batch processing device for file content and filename, such as... Figure 3 As shown, the device includes: an acquisition unit 31, a determination unit 32, and a linkage processing unit 33.
[0058] The acquisition unit 31 can be used to acquire a batch of files to be processed.
[0059] The determining unit 32 can be used to determine a preset keyword list and content replacement strategy required for replacing the content of the batch of files to be processed, and to determine a file naming strategy required for naming the batch of files to be processed. The preset keyword list includes the search content in the batch of files to be processed and the replacement content corresponding to the search content.
[0060] The linkage processing unit 33 can be used to determine the number of file processing threads based on the number of files in the batch to be processed, and to call the corresponding number of file processing threads to perform batch linkage file content replacement processing and file naming processing on the batch to be processed based on the preset keyword list, the content replacement strategy, and the file naming strategy.
[0061] In specific application scenarios, to determine the content replacement strategy, the determining unit 32 can be used to determine the filename suffix and header information of each file to be processed in the batch of files to be processed; based on the filename suffix and header information, determine the file format of each file to be processed in the batch of files to be processed; determine the content format of the content to be replaced in each file to be processed; based on the content format, determine the file content replacement format of the corresponding file to be processed; based on the file format, determine the file processing engine of the corresponding file to be processed; and determine the file content replacement range and file content replacement format of each file to be processed. Based on the file content replacement format, the file processing engine, the file content replacement range, and the file content replacement format, determine the content replacement strategy. The method for determining the file content replacement format of the corresponding file to be processed based on the content format includes: if the content format is text content, then determining the fuzzy replacement format of the text content of the corresponding file to be processed; if the content format is formula content, then determining the fine replacement format of the formula content of the corresponding file to be processed; if the content format is numeric content, then determining the regularized replacement format of the numeric content of the corresponding file to be processed.
[0062] In specific application scenarios, in order to determine the file naming strategy, such as Figure 4 As shown, the determining unit 32 includes an acquisition module 321 and a determining module 322.
[0063] The acquisition module 321 can be used to acquire the file content extraction position set by the client for the batch of files to be processed through the visual rule editor.
[0064] The acquisition module 321 can also be used to acquire multiple file naming items selected by the client for the batch of files to be processed through the visual rule editor, wherein the file naming items include at least the file content extraction value item.
[0065] The determining module 322 can be used to associate the file content extraction position with the file content extraction value item to obtain the associated file content extraction value item, and determine the positional order between the associated file content extraction value item and the remaining file naming items. Based on the associated file content extraction value item with the positional order and the remaining file naming items, the file naming strategy is determined, wherein the remaining file naming items are each file naming item after removing the file content extraction value item.
[0066] In specific application scenarios, in order to process duplicate filenames, the device further includes a duplicate processing unit 34.
[0067] The duplicate processing unit 34 can be used to determine whether there are duplicate filenames in the named files. If so, it obtains the file feature data, file storage feature data, file association item data, and user feature data of the client user who performed the file naming operation for each named file corresponding to the duplicate filename. Based on the file feature data, the file storage feature data, the file association item data, and the user feature data, it determines the filename suffix of the corresponding named file and constructs a new filename for the named file by combining the original name of the corresponding named file with the filename suffix.
[0068] In specific application scenarios, in order to adjust the file replacement effect and file naming effect, the device also includes an adjustment unit 35.
[0069] The adjustment unit 35 can be used to generate and display file content replacement preview information for each file to be processed in the batch of files to be processed, based on the preset keyword list and the content replacement strategy, and to generate and display file name preview information for each file to be processed in the batch of files to be processed, based on the file naming strategy; based on the displayed file content replacement preview information and file name preview information, determine the predicted batch linkage processing effect of the batch of files to be processed; if the predicted batch linkage processing effect does not meet the requirements, then adjust the preset keyword list, the content replacement strategy, and the file naming strategy.
[0070] In specific application scenarios, in order to perform batch linked processing of files, the linked processing unit 33 can be used to call a corresponding number of file processing threads to perform batch linked file content replacement processing and file naming processing on the batch of files to be processed based on the adjusted preset keyword list, the adjusted content replacement strategy, and the adjusted file naming strategy.
[0071] In specific application scenarios, the device further includes a backup unit 36 for backing up files.
[0072] The backup unit 36 can be used to display a confirmation pop-up page in response to a batch linkage execution signal triggered by the client for the batch of pending files. The confirmation pop-up page includes a confirmation control and pending confirmation information, wherein the pending confirmation information includes the number of files in the batch, the preset keyword list, the content replacement strategy, the file naming strategy, and the file backup path. Based on the pending confirmation information, it is determined whether the confirmation control needs to be triggered. If so, the batch of pending files is backed up and stored in response to the trigger signal of the confirmation control.
[0073] In specific application scenarios, in order to generate a processing result report, the device also includes a report generation unit 37.
[0074] The report generation unit 37 can be used to record the processing operation information of the batch of files to be processed during the file content replacement and file naming process, generate and store the operation log based on the processing operation information, and generate a log download link for the stored operation log; identify the files that are processed abnormally and the files that are processed successfully among the batch of files to be processed, determine the exception type corresponding to the files that are processed abnormally, and generate a list of successful files corresponding to the files that are processed successfully and a list of exception files corresponding to the files that are processed abnormally and their corresponding exception types; and generate a processing result report for the batch of files to be processed based on the log download link, the list of successful files, and the list of exception files.
[0075] It should be noted that other corresponding descriptions of the functional modules involved in the batch processing device for file content and file name provided in this embodiment of the invention can be found in the following references. Figure 1 The corresponding description of the method shown will not be repeated here.
[0076] Based on the above, Figure 1 Accordingly, this embodiment of the invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the following steps: acquiring a batch of files to be processed; determining a preset keyword list and content replacement strategy required for replacing the content of the batch of files to be processed, and determining a file naming strategy required for naming the batch of files to be processed, wherein the preset keyword list includes search content and replacement content corresponding to the search content in the batch of files to be processed; determining the number of file processing threads based on the number of files in the batch of files to be processed, and calling the corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed based on the preset keyword list, the content replacement strategy, and the file naming strategy.
[0077] Based on the above, Figure 1 The method shown and as Figure 3 The embodiment of the device shown in the invention also provides a physical structure diagram of a computer device, such as... Figure 5 As shown, the computer device includes: a processor 41, a memory 42, and a computer program stored in the memory 42 and executable on the processor. Both the memory 42 and the processor 41 are mounted on a bus 43. When the processor 41 executes the program, it performs the following steps: acquiring a batch of files to be processed; determining a preset keyword list and content replacement strategy required for replacing the content of the batch of files to be processed, and determining a file naming strategy required for naming the batch of files to be processed, wherein the preset keyword list contains search content and corresponding replacement content in the batch of files to be processed; determining the number of file processing threads based on the number of files in the batch of files to be processed, and calling the corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed based on the preset keyword list, the content replacement strategy, and the file naming strategy.
[0078] Through the technical solution of this invention, the invention obtains a batch of files to be processed; then determines a preset keyword list and content replacement strategy required for replacing the content of the batch of files to be processed, and determines a file naming strategy required for naming the batch of files to be processed. The preset keyword list includes search content and corresponding replacement content in the batch of files to be processed. Finally, based on the number of files in the batch, the number of file processing threads is determined, and based on the preset keyword list, the content replacement strategy, and the file naming strategy, the corresponding number of file processing threads are invoked to perform batch-linked file content replacement and file naming processing on the batch of files to be processed. Therefore, by performing batch-linked file content replacement and file naming processing on a batch of files, synchronous processing of file content replacement and file naming can be achieved, thereby saving document processing time and improving document processing efficiency. Using file processing threads to perform content replacement and file naming processing avoids errors caused by manual processing, thereby improving the accuracy of file content replacement and naming. Multi-threaded collaborative file processing further improves file processing efficiency.
[0079] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0080] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for batch processing of file content and filenames, characterized in that, include: Get a batch of files to be processed; A preset keyword list and content replacement strategy are determined for replacing the content of the batch of files to be processed, and a file naming strategy is determined for naming the batch of files to be processed. The preset keyword list includes the search content and the replacement content corresponding to the search content in the batch of files to be processed. Based on the number of files to be processed in the batch, the number of file processing threads is determined, and based on the preset keyword list, the content replacement strategy, and the file naming strategy, the corresponding number of file processing threads are invoked to perform batch-linked file content replacement and file naming processing on the batch of files to be processed.
2. The method according to claim 1, characterized in that, Determine the content replacement strategy required for replacing the content of the batch of files to be processed, including: Determine the filename suffix and header information of each file in the batch to be processed files, and determine the file format of each file in the batch to be processed files based on the filename suffix and header information; The process involves determining the content format of the content to be replaced in each file to be processed, determining the file content replacement format for the corresponding file based on the content format, determining the file processing engine for the corresponding file based on the file format, and determining the file content replacement range and file content replacement format for each file to be processed. Based on the file content replacement format, the file processing engine, the file content replacement range, and the file content replacement format, the content replacement strategy is determined. The method for determining the file content replacement format for the corresponding file to be processed based on the content format includes: If the content is text, then the fuzzy replacement form of the text content in the corresponding file to be processed is determined; if the content is formula, then the fine replacement form of the formula content in the corresponding file to be processed is determined; if the content is numeric, then the regularized replacement form of the numeric content in the corresponding file to be processed is determined.
3. The method according to claim 1, characterized in that, The process of determining the file naming strategy required for naming the batch of files to be processed includes: Obtain the file content extraction location set by the client for the batch of files to be processed through the visual rule editor; Obtain multiple file naming items selected by the client for the batch of files to be processed through a visual rule editor, wherein the file naming items include at least a file content extraction value item; The file content extraction location is associated with the file content extraction value item to obtain the associated file content extraction value item, and the positional order between the associated file content extraction value item and the remaining file naming items is determined. Based on the associated file content extraction value item with the positional order and the remaining file naming items, the file naming strategy is determined, wherein the remaining file naming items are each file naming item after removing the file content extraction value item.
4. The method according to claim 1, characterized in that, After invoking a corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed, the method further includes: Determine if there are duplicate filenames in the named files. If so, obtain the file feature data, file storage feature data, file association item data, and user feature data of the client user who performed the file naming operation for each named file corresponding to the duplicate filename. Based on the file feature data, the file storage feature data, the file association item data, and the user feature data, the file name suffix of the corresponding named file is determined, and the new file name of the named file is formed by the civilization name of the corresponding named file and the file name suffix.
5. The method according to claim 1, characterized in that, Before invoking the appropriate number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed, the method further includes: Based on the preset keyword list and the content replacement strategy, generate and display the file content replacement preview information for each file in the batch of files to be processed, and generate and display the file name preview information for each file in the batch of files to be processed based on the file naming strategy. Based on the displayed file content replacement preview information and file naming preview information, the predicted batch linkage processing effect of the batch of files to be processed is determined. If the predicted batch linkage processing effect does not meet the requirements, the preset keyword list, the content replacement strategy, and the file naming strategy are adjusted. The process of calling a corresponding number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed includes: Based on the adjusted preset keyword list, the adjusted content replacement strategy, and the adjusted file naming strategy, a corresponding number of file processing threads are invoked to perform batch-linked file content replacement and file naming processing on the batch of files to be processed.
6. The method according to claim 1, characterized in that, Before invoking the appropriate number of file processing threads to perform batch-linked file content replacement and file naming processing on the batch of files to be processed, the method further includes: In response to the batch linkage execution signal triggered by the client for the batch of pending files, a confirmation pop-up page is displayed. The confirmation pop-up page includes a confirmation control and information to be confirmed. The information to be confirmed includes the number of files in the batch of pending files, the preset keyword list, the content replacement strategy, the file naming strategy, and the file backup path. Based on the information to be confirmed, determine whether it is necessary to trigger the confirmation control. If so, in response to the trigger signal of the confirmation control, back up and store the batch of files to be processed.
7. The method according to claim 1, characterized in that, The method further includes: Record the processing operation information of the batch of files to be processed during the file content replacement and file naming process, generate and store the operation log based on the processing operation information, and generate a log download link for the stored operation log; In the batch of pending files, identify the files that are processing errors and the files that are processing successfully, determine the error type corresponding to the files that are processing errors, and generate a list of successful files corresponding to the files that are processing successfully and a list of error files corresponding to the files that are processing errors and their corresponding error types. Based on the log download link, the list of successful files, and the list of abnormal files, a processing result report is generated for the batch of files to be processed.
8. A batch processing device for file content and filename, characterized in that, include: The acquisition unit is used to acquire a batch of files to be processed. The determining unit is used to determine a preset keyword list and content replacement strategy required to replace the file content of the batch of files to be processed, and to determine a file naming strategy required to name the batch of files to be processed, wherein the preset keyword list includes the search content in the batch of files to be processed and the replacement content corresponding to the search content; The linkage processing unit is used to determine the number of file processing threads based on the number of files to be processed in the batch, and to call the corresponding number of file processing threads to perform batch linkage file content replacement processing and file naming processing on the batch of files to be processed based on the preset keyword list, the content replacement strategy, and the file naming strategy.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.