A file automatic cleaning method, device and equipment and readable storage medium

By employing multi-dimensional decision-making through semantic analysis and dependency analysis, this technology addresses the challenge of balancing security and resource optimization in existing file cleanup decisions, thereby improving both the security and efficiency of automatic file cleanup.

CN123157672APending Publication Date: 2026-11-24THREE GORGES HI TECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611181578.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-05
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies cannot accurately assess the business importance and related importance of files, making it difficult to balance security and resource optimization efficiency in file cleanup decisions. This can easily lead to the accidental deletion of critical dependent files or the inability to effectively release storage resources.

Method used

The business importance of files is assessed by semantic analysis models, a file dependency graph is constructed and node criticality is calculated, and cleanup control instructions are generated by combining reinforcement learning strategies to ensure security and resource optimization.

Benefits of technology

It achieves accurate assessment of file importance, avoids accidental deletion of critical files, effectively frees up storage space, and balances security with resource optimization efficiency while ensuring stable system operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157672A_ABST
    Figure CN123157672A_ABST
Patent Text Reader

Abstract

A file automatic cleaning method, device and equipment and readable storage medium, the method comprises: obtaining running state data of a to-be-processed file, the running state data at least comprising file metadata, file content information and process association information; performing semantic feature analysis and importance evaluation on the running state data through a semantic analysis model to obtain a business importance score and a file type classification; constructing a file dependency graph based on the running state data, performing node criticality calculation on the file dependency graph through a dependency analysis model to obtain a dependency score; generating a cleaning control instruction for the to-be-processed file based on the business importance score, the file type classification and the dependency score through a preset decision model, and calling a file operation interface to execute the cleaning control instruction. The application makes a multi-dimensional comprehensive decision by combining semantic analysis and dependency analysis, so that the cleaning operation can take into account safety and resource optimization efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of operating system operation and maintenance management, specifically to a method, apparatus, device, and readable storage medium for automatic file cleanup. Background Technology

[0002] With the rapid development of computer technology and operating systems, the amount of data generated by users in their daily lives and work is growing exponentially. During operation, the operating system generates a large number of log files, temporary files, cached data, and application remnant files. If these files accumulate over a long period, they not only occupy valuable disk storage space but may also lead to decreased system input / output performance, increased response latency, and even system crashes. Therefore, how to efficiently and safely clean up redundant files in the operating system automatically, free up storage resources, and optimize system performance has become a crucial need that urgently needs to be addressed in the field of operating system operation and maintenance management.

[0003] In existing technologies, operating system file cleanup typically relies on predefined static rules or simple metadata analysis. For example, common cleanup tools determine whether to delete files based on their last access time, file size, or file extension, such as deleting log files older than a certain number of days or temporary files larger than a certain size. Some advanced solutions may incorporate traditional machine learning algorithms to classify files based on their historical access frequency or basic characteristics. These methods primarily perform cleanup operations through scheduled scripts or system daemons, which can reduce manual intervention to some extent and achieve basic storage space maintenance.

[0004] However, existing data cleaning methods mainly rely on preset static rules or shallow file metadata, which suffer from problems such as rigid rules and a lack of semantic understanding of file content. Because they cannot deeply analyze the actual business meaning of files and their dependencies on system processes, existing solutions cannot accurately assess the business importance and relational importance of files. This makes it difficult to balance security and resource optimization efficiency in cleaning decisions. Not only is it prone to compromising system stability by mistakenly deleting critical dependent files, but conservative rules also fail to effectively release storage resources. Summary of the Invention

[0005] This application provides a method, apparatus, device, and readable storage medium for automatic file cleaning, which can solve the technical problem in the prior art that the business importance and relevance of files cannot be accurately assessed, making it difficult to balance security and resource optimization efficiency in cleaning decisions.

[0006] In a first aspect, embodiments of this application provide an automatic file cleanup method, including: Obtain the running status data of the file to be processed. The running status data includes at least file metadata, file content information, and process association information. Semantic feature analysis and importance assessment are performed on the runtime status data using a semantic analysis model to obtain a business importance score and file type classification; A file dependency graph is constructed based on runtime status data. The dependency analysis model is used to calculate the node criticality of the file dependency graph and obtain the dependency score. Based on business importance scoring, file type classification, and dependency scoring, a pre-built decision model is used to generate cleanup control instructions for the files to be processed, and the file operation interface is called to execute the cleanup control instructions.

[0007] In conjunction with the first aspect, in one implementation, semantic feature analysis and importance assessment are performed on the operational status data using a semantic analysis model to obtain a business importance score and file type classification, including: Semantic features are extracted from the document content to obtain a semantic vector of the content summary; Structured prompts are constructed based on file content information, process association information, content summary semantic vectors, and preset prompt templates; The structured prompts are input into the semantic analysis model, which outputs a file type classification and a business importance score that represents the business importance of the file. Among them, the semantic analysis model is a large language model fine-tuned with operating system domain data, used to understand the business meaning of the file content.

[0008] In conjunction with the first aspect, in one implementation, a file dependency graph is constructed based on runtime status data, including: Determine dynamic link library dependencies and file ownership relationships based on the file content information; Determine process opening relationships based on process association information; The files to be processed are mapped as graph nodes, and dynamic link library dependencies, file ownership relationships, and process open relationships are mapped as graph edges to construct a file dependency graph.

[0009] In conjunction with the first aspect, in one implementation, a dependency relationship score is obtained by calculating the node criticality of the file dependency graph using a dependency relationship analysis model, including: Based on the file dependency graph, the feature information of each node and its neighboring nodes is aggregated through the dependency analysis model, and the node key indicators of each node are output. Dependency scores are determined based on key node indicators, and the dependency scores are positively correlated with the probability that system anomalies will occur after a file is deleted. The dependency analysis model is based on a graph neural network and is used to understand the dependencies between files and system processes.

[0010] In conjunction with the first aspect, in one implementation, based on business importance scoring, file type classification, and dependency scoring, a pre-defined decision model generates cleanup control instructions for the files to be processed, including: Construct file feature vectors based on business importance scores, file type classifications, and dependency relationship scores; A state space is constructed based on file feature vectors, current disk status, system load, and business identifiers; an action space is constructed based on the set of cleanup control instructions; and a reward function is constructed based on the amount of disk space released, the number of errors, read / write overhead, and the satisfaction of security constraints. Based on the state space, action space, and reward function, decision reasoning is performed through a pre-set decision model to obtain cleanup control instructions for the files to be processed. The decision-making model is built based on a reinforcement learning policy network, and the cleanup control instructions include deleting, retaining, migrating, compressing, or archiving tags.

[0011] In conjunction with the first aspect, in one implementation method, the automatic file cleanup method further includes: Compare dependency scores with preset criticality thresholds; If the dependency score is greater than or equal to the preset criticality threshold, the cleanup control instruction will be changed to a retention instruction.

[0012] In conjunction with the first aspect, in one implementation, the automatic file cleanup method further includes a model self-evolution step: Monitor the historical decision trajectory sequence of the decision-making model and user feedback signals; Based on historical decision-making trajectory sequences and user feedback signals, the semantic analysis model and decision-making model are incrementally fine-tuned periodically according to a preset update cycle to update the model parameters of the semantic analysis model and decision-making model.

[0013] Secondly, embodiments of this application provide an automatic file cleaning device, comprising: The data acquisition module is used to acquire the running status data of the file to be processed. The running status data includes at least file metadata, file content information and process association information. The semantic analysis module is used to perform semantic feature analysis and importance assessment on runtime status data through a semantic analysis model, resulting in a business importance score and file type classification. The dependency assessment module is used to construct a file dependency graph based on runtime status data, and to calculate the node criticality of the file dependency graph through a dependency analysis model to obtain a dependency score. The decision execution module is used to generate cleanup control instructions for the files to be processed based on business importance scoring, file type classification, and dependency scoring, and then call the file operation interface to execute the cleanup control instructions.

[0014] Thirdly, embodiments of this application provide an automatic file cleaning device, which includes a processor, a memory, and an automatic file cleaning program stored in the memory and executable by the processor, wherein when the automatic file cleaning program is executed by the processor, it implements the steps of the automatic file cleaning method as described above.

[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing an automatic file cleanup program, wherein when the automatic file cleanup program is executed by a processor, it implements the steps of the automatic file cleanup method described above.

[0016] The beneficial effects of the technical solutions provided in this application include: This application uses a semantic analysis model to perform semantic feature analysis and importance assessment on file content information, which can deeply understand the business meaning of the file and effectively assess its business importance. At the same time, by constructing a file dependency graph and calculating dependency scores based on a dependency analysis model, the application can accurately quantify the importance of file associations. By combining semantic analysis and dependency analysis into a multi-dimensional comprehensive decision-making process, the cleanup operation can balance security and resource optimization efficiency, effectively releasing storage space while ensuring stable system operation. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating an embodiment of the automatic document cleanup method of this application. Figure 2 This is a schematic diagram illustrating the semantic feature analysis and importance assessment process in an embodiment of this application. Figure 3 This is a schematic diagram illustrating the process of constructing a file dependency graph according to an embodiment of this application; Figure 4 This is a schematic diagram illustrating the node criticality calculation process in an embodiment of this application. Figure 5 This is a schematic diagram of the process for generating cleanup control instructions according to an embodiment of this application; Figure 6 This is a schematic diagram illustrating the process of modifying the cleanup control command according to an embodiment of this application; Figure 7 This is a flowchart illustrating the model self-evolution steps in an embodiment of this application; Figure 8 This is a functional module diagram of an embodiment of the automatic document cleaning device of this application; Figure 9 This is a schematic diagram of the hardware structure of the automatic file cleaning device involved in the embodiments of this application. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0020] In a first aspect, embodiments of this application provide an automatic file cleanup method.

[0021] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the automatic document cleanup method of this application. Figure 1 As shown, the automatic file cleanup methods include: S101. Obtain the running status data of the file to be processed. The running status data includes at least file metadata, file content information and process association information. S102. Perform semantic feature analysis and importance assessment on the operational status data through a semantic analysis model to obtain a business importance score and file type classification; S103. Construct a file dependency graph based on runtime status data, and calculate the node criticality of the file dependency graph using a dependency analysis model to obtain a dependency score; S104. Based on business importance score, file type classification and dependency score, generate cleanup control instructions for the files to be processed through a pre-set decision model, and call the file operation interface to execute the cleanup control instructions.

[0022] Specifically, in an embodiment of the automatic file cleanup method, the overall system structure includes a five-layer architecture: perception layer, cognition layer, decision-making layer, execution layer, and evolution layer.

[0023] The perception layer is responsible for acquiring the running status data of the files to be processed, including file metadata, file content information, and process association information. File metadata includes inode index, atime access time, mtime modification time, ctime status change time, size file size, and number of hard links; file content information includes comprehensive descriptive information such as filename, file type, file description, and corresponding software name; process association information includes process open handles. It also needs to acquire information such as the current system log generation rate and database backup status. The acquired data is processed into a structured data stream and pushed to the cognition layer.

[0024] The cognitive layer performs semantic feature analysis and importance assessment through a deployed semantic analysis model, which is fine-tuned based on a large language model. In this embodiment, a semantic feature extraction process is first performed on the file content information using an embedding model to obtain a content summary semantic vector. Then, combining the file content information, process association information, the content summary semantic vector, and preset prompt word templates, a structured prompt word is constructed as the input to the semantic analysis model. The output of the semantic analysis model includes a business importance score representing the importance of the file to be processed, as well as file type classification, etc.

[0025] Furthermore, the cognitive layer analyzes file dependencies using a dependency analysis model. In this embodiment, for a file to be processed, dynamic link library dependencies and dependencies can be determined based on its file content information, and process opening relationships can be determined based on process association information. Then, the embodiment maps the file to be processed as graph nodes, and maps dynamic link library dependencies, file dependencies, and process opening relationships as graph edges, constructing a file dependency graph. Next, using a dependency analysis model built on a graph neural network, the feature information of each node and its neighboring nodes is aggregated, outputting a node keyity index for each node. Then, a dependency score is determined based on the node keyity index. This dependency score can quantify the importance of file associations and is positively correlated with the probability that file deletion will cause system anomalies.

[0026] Next, the decision layer constructs a reinforcement learning decision network based on a near-end policy optimization algorithm as the decision model for automatic file cleanup. In this embodiment, after vectorizing content such as business importance score, file type classification, and dependency score to obtain file feature vectors, the file feature vectors are combined with current disk status, system load, and business identifiers to form a state space. Then, a set of discretized cleanup control instructions is used as the action space, where cleanup control instructions include compression, deletion, migration to cold storage, retention, or archiving. The reward function is constructed based on the amount of disk space released, the number of errors, read / write overhead, and security constraint satisfaction. Combining the state space, action space, and reward function, this embodiment uses the decision model to perform decision reasoning to generate cleanup control instructions for the files to be processed.

[0027] The execution layer calls the file operation interface provided by the system to perform cleanup operations. The execution layer is deeply integrated with the system management program, and all operations are executed in a transactional manner, supporting rehearsal mode and atomic rollback to ensure self-repair in the event of risks.

[0028] The evolutionary layer deploys a continuous learning module based on experience replay and elastic weight consolidation. In the evolutionary layer, by collecting historical decision trajectory sequences (i.e., state-action-reward sequences) from the decision-making layer and user feedback signals (such as intervention signals input through local association interfaces or command-line interfaces), the semantic analysis model and decision-making model are incrementally fine-tuned periodically according to a preset update cycle, so that the system can continuously adapt to new scenarios without forgetting existing knowledge.

[0029] In this embodiment, semantic feature analysis and importance assessment of file content information are performed through a semantic analysis model, which can deeply understand the business meaning of the file and effectively assess its business importance. At the same time, by constructing a file dependency graph and calculating dependency scores based on the dependency analysis model, the association importance of the file can be accurately quantified. By combining semantic analysis and dependency analysis into a multi-dimensional comprehensive decision-making process, the cleanup operation can balance security and resource optimization efficiency, effectively releasing storage space while ensuring stable system operation.

[0030] Furthermore, in one embodiment, Figure 2 This is a flowchart illustrating the semantic feature analysis and importance assessment process in an embodiment of this application, as shown below. Figure 2 As shown, semantic feature analysis and importance assessment are performed on the operational status data using a semantic analysis model, resulting in a business importance score and file type classification, including: S201. Extract semantic features from the document content information to obtain a semantic vector of the content summary; S202. Construct structured prompts based on file content information, process association information, content summary semantic vectors, and preset prompt templates; S203. Input the structured prompt words into the semantic analysis model and output the file type classification and the business importance score that represents the business importance of the file; Among them, the semantic analysis model is a large language model fine-tuned with operating system domain data, used to understand the business meaning of the file content.

[0031] Specifically, the runtime status data of the file to be processed includes file metadata, file content information, and process association information. In this embodiment, the operating system kernel provides an eBPF (Extended Berkeley PacketFilter) probe, an inotify file system event monitoring interface, and / proc and / sys virtual file system interfaces to collect file system metadata (inode, atime, mtime, ctime, size, number of hard links), open file handles of processes (by parsing / proc / [pid] / fd and calling the lsof command), system log generation rate (by journald or rsyslog interface), and database backup task status (by parsing crontab and database native logs). After structured processing, the structured data stream is pushed to the cognitive layer via Unix Domain Socket.

[0032] The cognitive layer deploys a custom large language model (C-LLM) finely tuned by LoRA (Low-Rank Adaptation) as the semantic analysis model. The base model adopts an open-source large language model adapted to the domestic CPU architecture (such as a domestically adapted version of Qwen2.5-14B or Llama3-8B), and uses 4-bit QLoRA quantization technology to reduce GPU memory / memory usage.

[0033] Upon receiving the structured data stream, the embodiment extracts a 256-dimensional semantic vector from the file content information (such as filename, file type, file description, and corresponding software name) using the BGE-M3 embedding model. Then, based on the file content information, process association information, and the content summary semantic vector, the embodiment constructs structured prompts using a preset prompt template, for example: "[System Context] Operating System: Kylin V10; Architecture: ARM64; Disk Utilization: 87%; Business Period: Peak Transaction Time; [File Description] Path: / var / log / app / ; Filename: debug_20250401.log; Size: 2.3GB; mtime: 30 days ago; Content Summary: <256-dimensional semantic vector extracted using the BGE-M3 embedding model>; Process Association: PID 1234 (mysql); [Task] Evaluate file type and importance score, output JSON."

[0034] Then, after semantic feature analysis and importance assessment, the semantic analysis model outputs file type classification and business importance score in JSON format, for example: {"file_type": "redundant_log", "importance_score": 0.15, "confidence": 0.92, "reasoning": "The file is a debugging log from 30 days ago, currently has no associated processes, and the business period is peak transaction time, so it is recommended to delete it after migration", "recommended_action": "compress_then_delete_after_7days"}.

[0035] Furthermore, in this embodiment, for the input content, the semantic vector of the content summary can be associated with file paths, metadata, etc., through a cross-attention mechanism within the model to ensure the fusion of semantic features and system features. Additionally, for model inference, INT8 quantization and operator optimization can be performed on the semantic analysis model using OpenVINO, Ascend CANN, Cambricon Neuware, etc., to accelerate inference.

[0036] In this embodiment, semantic feature analysis and importance assessment of file content information are performed through a semantic analysis model, which can deeply understand the business meaning of the file and effectively assess the business importance of the file. In file cleaning, it can effectively distinguish junk files and avoid the problem of rigid rules in traditional methods.

[0037] Furthermore, in one embodiment, Figure 3 This is a schematic diagram illustrating the process of constructing a file dependency graph according to an embodiment of this application, such as... Figure 3 As shown, a file dependency graph is constructed based on runtime status data, including: S301. Determine dynamic link library dependencies and file ownership relationships based on file content information; S302. Determine the process opening relationship based on process association information; S303. Map the files to be processed as graph nodes, and map dynamic link library dependencies, file ownership relationships, and process opening relationships as graph edges to construct a file dependency graph.

[0038] Specifically, to avoid accidentally deleting critical system files, the cognitive layer also analyzes the critical files by constructing a file dependency graph.

[0039] In this embodiment, the file dependency graph uses the file to be processed as the graph node, and uses process open relationships (resolved via / proc / [pid] / maps and lsof), dynamic link library dependencies (resolved via ldd and readelf), and file dependency relationships between packages and files in the package database as edges to construct a heterogeneous graph. Each graph node's node features include the vectorized metadata features of the file to be processed (7 dimensions: size, timestamp, permissions, number of hard links, etc.). Furthermore, in this embodiment, the JSON output of the semantic analysis model can also be vectorized and used as node features, depending on actual needs. This allows the business importance of files to be included in the analysis factors when analyzing file association importance.

[0040] Furthermore, in one embodiment, Figure 4 This is a schematic diagram illustrating the node criticality calculation process in an embodiment of this application, as shown below. Figure 4 As shown, the dependency relationship graph is analyzed using a dependency relationship analysis model to calculate the node criticality and obtain a dependency relationship score, including: S401. Based on the file dependency graph, aggregate the feature information of each node and its neighboring nodes through the dependency analysis model, and output the node key indicators of each node. S402. Determine the dependency score based on the node's key indicators. The dependency score is positively correlated with the probability that the system will malfunction after a file is deleted. The dependency analysis model is based on a graph neural network and is used to understand the dependencies between files and system processes.

[0041] Specifically, for the file dependency graph, the dependency analysis model in this embodiment uses a two-layer GraphSAGE (Graph Sample and Aggregate, graph neural network) for message passing, aggregating the feature information of each node and its neighboring nodes, and outputting the SCS (System Criticality Score) of each node. This score is then used as the dependency score for each file. That is, the more important a node is, the greater the likelihood that its deletion will cause system anomalies, and thus the higher its dependency score. The GraphSAGE parameters are: hidden layer dimension 256, aggregation function is mean aggregation, activation function is ReLU, and output layer dimension 1 (activated by Sigmoid).

[0042] In addition, in the embodiments, the Tarjan strongly connected component algorithm can be used to detect circular dependencies between files (such as A.so depending on B.so, and B.so depending on A.so), and the circularly dependent files can be treated as a whole to make decisions to ensure that the cleanup strategy does not destroy the integrity of the circular dependency structure.

[0043] In this embodiment, by constructing a file dependency graph and calculating a dependency score based on a dependency analysis model, the importance of file associations can be accurately quantified, avoiding the accidental deletion of critical system files during file cleanup.

[0044] Furthermore, in one embodiment, Figure 5 This is a schematic diagram of the process for generating cleanup control instructions according to an embodiment of this application, such as... Figure 5 As shown, based on business importance scoring, file type classification, and dependency scoring, a pre-defined decision model generates cleanup control instructions for the files to be processed, including: S501. Construct a file feature vector based on business importance score, file type classification, and dependency relationship score; S502: Construct a state space based on file feature vectors, current disk status, system load, and business identifiers; construct an action space based on the cleanup control command set; and construct a reward function based on the amount of disk space released, number of errors, read / write overhead, and security constraint satisfaction. S503. Based on the state space, action space, and reward function, a pre-set decision model is used to perform decision reasoning to obtain cleanup control instructions for the files to be processed. The decision-making model is built based on a reinforcement learning policy network, and the cleanup control instructions include deleting, retaining, migrating, compressing, or archiving tags.

[0045] Furthermore, in one embodiment, Figure 6 This is a flowchart illustrating the modification of the cleanup control command in an embodiment of this application, as shown below. Figure 6 As shown, automatic file cleanup methods also include: S601. Compare the dependency score with the preset criticality threshold; S602. If the dependency score is greater than or equal to the preset criticality threshold, the cleanup control instruction will be modified to a retention instruction.

[0046] Specifically, at the decision-making level, the implementation vectorizes the business importance score and file type classification obtained from the semantic analysis model, as well as the dependency score obtained from dependency analysis, to construct a file feature vector. Then, the decision-making level uses the file feature vector, current disk usage, system load average, and business time period identifiers (encoded by timestamps) to form the state space; a discretized set of cleanup control instructions (delete, retain, migrate, compress, or archive markers) is used as the action space; and the reward function is designed as a composite function.

[0047] in, This indicates the amount of disk space being released. This indicates the number of system service errors after cleanup (obtained through systemd status monitoring). This indicates the read / write overhead incurred during the cleanup process. This represents the satisfaction of security constraints based on the file dependency graph (calculated via a graph neural network). , , and These are configurable weighting coefficients.

[0048] In the decision-making level, decision-making models A three-layer fully connected neural network is used, with the input layer dimension equal to the cognitive layer dimension plus the system state dimension, hidden layers [512, 256, 128], and the output layer dimension equal to the action space size (5). The activation function is LeakyReLU, and the output layer is Softmax. The architecture has a linear activation output layer.

[0049] In this embodiment, decision reasoning is performed through a decision model, which can comprehensively consider the business importance and dependencies of the files to obtain cleanup control instructions (such as deletion, retention, migration, compression, or archiving tags) for each file to be processed.

[0050] Meanwhile, to ensure that critical files are not deleted during the automatic cleanup decision-making process, a criticality threshold (such as 0.85) is preset in the embodiment. When the dependency score is greater than or equal to the preset criticality threshold, the file is not allowed to be deleted, and regardless of the cleanup control instruction obtained during the decision-making process, it is corrected to a retention instruction.

[0051] In this embodiment, the decision model combines semantic analysis and dependency analysis into a multi-dimensional comprehensive decision, enabling the cleanup operation to balance security and resource optimization efficiency. In addition, for critical files with dependency scores greater than a preset criticality threshold, the embodiment also sets security constraints, thereby effectively releasing storage space while ensuring the stable operation of the system.

[0052] Furthermore, in one embodiment, Figure 7 This is a flowchart illustrating the model self-evolution steps in an embodiment of this application, as shown below. Figure 7 As shown, the self-evolutionary steps of the model include: S701, Monitor the historical decision trajectory sequence of the decision-making model and user feedback signals; S702. Based on the historical decision trajectory sequence and user feedback signals, the semantic analysis model and decision model are incrementally fine-tuned periodically according to the preset update cycle to update the model parameters of the semantic analysis model and decision model.

[0053] Specifically, to enable the model to continuously adapt to business changes, the implementation example also incorporates a self-evolution mechanism. During the training of the decision model, the training parameters include: discount factor. , GAE (Generalized AdvantageEstimation) parameters PPO cutting factor Learning rate The experience replay buffer size is 10,000 trajectories, and after collecting 2,048 steps in each round, a mini-batch update is performed for 10 epochs (batch_size=64).

[0054] During the training phase, the implementation can also introduce a security exploration mechanism. By using constraint masks, the probability of "delete" action for files with dependency scores greater than or equal to a preset criticality threshold is set to 0, thus ensuring the security of the exploration process.

[0055] In this embodiment, the system enters an evolutionary cycle every 24 hours (configurable), collecting all historical decision trajectory sequences from the past 24 hours. It then calculates the diagonal elements of the Fisher information matrix using the EWC (Elastic Weight Consolidation) algorithm, constrains the variation amplitude of important parameters (regularization coefficient λ_ewc = 1000), and performs one round of incremental gradient updates. Simultaneously, it employs Prioritized Experience Replay, prioritizing the sampling of high-reward absolute values. The trajectory converges rapidly.

[0056] Meanwhile, the embodiment also automatically generates structured statistical reports and rectification suggestions through a natural language generation module. Specifically, after each cleanup operation, the operation log (file path, cleanup method, space released, SCS before cleanup, C-LLM confidence level) is written to a local SQLite database. The NLG module, based on predefined templates and C-LLM generation capabilities, outputs a statistical report containing the following dimensions: Spatial dimensions: total free space, percentage of each type of junk (pie chart data), disk usage change curve; Time dimension: garbage generation rate (MB / day), peak generation periods; Security dimensions: Number of accidental deletions blocked (number of times high-scoring SCS files were blocked from deletion), number of manual review triggers, and number of system service anomalies (comparison before and after cleanup); Trend dimension: Disk space demand for the next 7 days is predicted based on the exponential smoothing method (Holt-Winters model, parameters α=0.3, β=0.1).

[0057] The report output format is a dual-modal format of Markdown and JSON, which is for both human readers and upper-level operation and maintenance platforms to parse.

[0058] The rectification suggestions are generated based on statistical report data and system configuration information, identifying root causes. Inputs include: the source of log generation (which application, what log level), backup strategy configuration (crontab content, database backup script), and historical cleanup patterns. The output is the rectification suggestions in JSON format.

[0059] In addition, the embodiment also includes an automatic repair mechanism, including a three-level repair system, which is executed progressively according to risk level, including: Configuration-level automatic repair (L1 - Low Risk): For suggestions marked "auto_fixable: true" in the rectification comments and involving configuration file modifications, the execution layer directly modifies the target configuration file using the Auguaas library (a configuration file parsing and editing library that supports mainstream configuration file syntax for domestic operating systems). A configuration backup (with a .bak extension and timestamp) is automatically created before modification, and the configuration is smoothly loaded after modification using the systemd reload command without requiring a service restart. If configuration verification fails (e.g., nginx-t reports an error after modification), it automatically rolls back to the backup version.

[0060] Service-level automated repair (L2 - Medium Risk): For repair suggestions requiring service restart or adjustment of runtime parameters (e.g., a service reporting an error due to missing temporary files after cleanup), the execution layer calls the systemd D-Bus interface to restart the service (systemctl restart) or adjust parameters (e.g., modifying kernel parameters via sysctl). Dependency impact analysis is performed before execution: using systemd's After / Before dependency graph, the impact of restarting the target service on upstream and downstream services is assessed. If critical business services are affected (units marked as Critical), automated execution is paused, and a work order awaiting manual confirmation is generated.

[0061] System-level automatic repair and rollback (L3 - High-risk / Mistaken deletion recovery): If the execution layer detects an anomaly in the system after cleanup (such as SCS misjudgment leading to the deletion of critical files, or continuous service restart failures), the system automatically triggers a rollback mechanism: using a pre-created file system snapshot (Btrfs subvolume snapshot or LVM snapshot), the affected directory is restored to its state before cleanup within 30 seconds. Simultaneously, the evolution layer marks the misjudged sample as a strong negative sample (Reward=-10), immediately triggering Emergency Fine-tuning, using EWC to quickly correct model parameters on a single sample to prevent similar errors from recurring.

[0062] After all automatic repair operations are executed, the system verifies the repair effect through a health check probe (based on HTTP / TCP / command return value). The repair is considered successful only if the probe is successful for 3 consecutive times (with an interval of 10 seconds); otherwise, an alarm escalation is triggered.

[0063] In summary, the automatic file cleanup method provided in this application performs semantic feature analysis and importance assessment on file content information through a semantic analysis model, enabling a deep understanding of the business meaning of files and effectively assessing their business importance. Simultaneously, by constructing a file dependency graph and calculating dependency scores based on a dependency analysis model, it can accurately quantify the association importance of files. Through multi-dimensional comprehensive decision-making combining semantic analysis and dependency analysis, the cleanup operation can balance security and resource optimization efficiency, effectively releasing storage space while ensuring stable system operation.

[0064] Secondly, embodiments of this application also provide an automatic file cleaning device.

[0065] In one embodiment, reference is made to Figure 8 , Figure 8 This is a schematic diagram of the functional modules of an embodiment of the automatic document cleaning device of this application. Figure 8 As shown, the automatic file cleanup device includes: The data acquisition module 801 is used to acquire the running status data of the file to be processed. The running status data includes at least file metadata, file content information and process association information. The semantic analysis module 802 is used to perform semantic feature analysis and importance assessment on the runtime status data through a semantic analysis model, and obtain business importance score and file type classification. The dependency evaluation module 803 is used to construct a file dependency graph based on runtime status data, and to calculate the node criticality of the file dependency graph through a dependency analysis model to obtain a dependency score. The decision execution module 804 is used to generate cleanup control instructions for the files to be processed based on business importance scoring, file type classification and dependency scoring, through a pre-set decision model, and to call the file operation interface to execute the cleanup control instructions.

[0066] The functions of each module in the above-mentioned automatic file cleaning device correspond to the steps in the above-mentioned automatic file cleaning method embodiment, and their functions and implementation processes will not be described in detail here.

[0067] Thirdly, embodiments of this application provide an automatic file cleaning device, which can be a personal computer (PC), laptop, server, or other device with data processing capabilities.

[0068] Reference Figure 9 , Figure 9 This is a schematic diagram of the hardware structure of the automatic file cleanup device involved in the embodiments of this application. In the embodiments of this application, the automatic file cleanup device may include a processor, a memory, a communication interface, and a communication bus.

[0069] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.

[0070] The communication interface includes input / output (I / O) interfaces, physical interfaces, and logical interfaces used for interconnecting internal components of the automatic file cleanup device, as well as interfaces used for interconnecting the automatic file cleanup device with other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.

[0071] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0072] The processor can be a general-purpose processor, which can call the file automatic cleanup program stored in memory and execute the file automatic cleanup method provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the file automatic cleanup program is called can be referred to in the various embodiments of the file automatic cleanup method of this application, and will not be repeated here.

[0073] Those skilled in the art will understand that Figure 9 The hardware structure shown does not constitute a limitation of this application and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0074] Fourthly, embodiments of this application also provide a computer-readable storage medium.

[0075] The present application provides a computer-readable storage medium storing an automatic file cleanup program, wherein when the automatic file cleanup program is executed by a processor, it implements the steps of the automatic file cleanup method described above.

[0076] The method implemented when the automatic file cleanup program is executed can be referred to in various embodiments of the automatic file cleanup method of this application, and will not be repeated here.

[0077] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0078] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.

[0079] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.

[0080] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0081] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.

[0082] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods of the various embodiments of this application.

[0083] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A method for automatically cleaning up files, characterized in that, include: Obtain the running status data of the file to be processed, wherein the running status data includes at least file metadata, file content information and process association information; The operational status data is analyzed for semantic features and its importance is assessed using a semantic analysis model to obtain a business importance score and file type classification. Based on the running status data, a file dependency graph is constructed. The dependency analysis model is used to calculate the node criticality of the file dependency graph to obtain a dependency score. Based on the business importance score, the file type classification, and the dependency score, a cleanup control instruction for the file to be processed is generated through a preset decision model, and the cleanup control instruction is executed by calling the file operation interface.

2. The automatic file cleanup method according to claim 1, characterized in that, The process of performing semantic feature analysis and importance assessment on the operational status data using a semantic analysis model to obtain a business importance score and file type classification includes: Semantic feature extraction is performed on the file content information to obtain a content summary semantic vector; Structured prompt words are constructed based on the file content information, the process association information, the content summary semantic vector, and the preset prompt word template; The structured prompts are input into a semantic analysis model, which outputs a file type classification and a business importance score that represents the business importance of the file. The semantic analysis model is a large language model fine-tuned with operating system domain data, used to understand the business meaning of the file content.

3. The automatic file cleanup method according to claim 1, characterized in that, The construction of the file dependency graph based on the runtime status data includes: Determine dynamic link library dependencies and file ownership relationships based on the file content information; The process opening relationship is determined based on the process association information; The files to be processed are mapped as graph nodes, and the dynamic link library dependencies, file ownership relationships, and process open relationships are mapped as graph edges to construct a file dependency graph.

4. The automatic file cleanup method according to claim 1, characterized in that, The process of calculating node criticality in the file dependency graph using a dependency analysis model to obtain a dependency score includes: Based on the file dependency graph, the feature information of each node and its neighboring nodes is aggregated through the dependency analysis model, and the node key indicators of each node are output. The dependency score is determined based on the key indicators of the nodes, and the dependency score is positively correlated with the probability that the system will malfunction after the file is deleted; The dependency analysis model is built on a graph neural network and is used to understand the dependency relationship between files and system processes.

5. The automatic file cleanup method according to claim 1, characterized in that, The step of generating cleanup control instructions for the files to be processed based on the business importance score, the file type classification, and the dependency relationship score, through a preset decision model, includes: Construct a file feature vector based on the business importance score, the file type classification, and the dependency relationship score; A state space is constructed based on the file feature vector, current disk status, system load, and service identifier; an action space is constructed based on the cleanup control instruction set; and a reward function is constructed based on the amount of disk space released, the number of error reports, read / write overhead, and security constraint satisfaction. Based on the state space, the action space, and the reward function, a decision reasoning process is performed using a preset decision model to obtain a cleanup control instruction for the file to be processed. The decision model is constructed based on a reinforcement learning policy network, and the cleanup control instructions include deleting, retaining, migrating, compressing, or archiving tags.

6. The automatic file cleanup method according to claim 5, characterized in that, The method further includes: The dependency score is compared with a preset criticality threshold; If the dependency score is greater than or equal to the preset criticality threshold, the cleanup control instruction will be modified to a retention instruction.

7. The automatic file cleanup method according to claim 1, characterized in that, The method also includes a model self-evolution step: Monitor the historical decision trajectory sequence and user feedback signals of the decision-making model; Based on the historical decision trajectory sequence and the user feedback signal, the semantic analysis model and the decision model are incrementally fine-tuned periodically according to a preset update cycle to update the model parameters of the semantic analysis model and the decision model.

8. An automatic file cleaning device, characterized in that, include: The data acquisition module is used to acquire the running status data of the file to be processed. The running status data includes at least file metadata, file content information and process association information. The semantic analysis module is used to perform semantic feature analysis and importance assessment on the runtime status data through a semantic analysis model to obtain a business importance score and file type classification; The dependency evaluation module is used to construct a file dependency graph based on the runtime status data, and to calculate the node criticality of the file dependency graph through a dependency analysis model to obtain a dependency score. The decision execution module is used to generate cleanup control instructions for the files to be processed based on the business importance score, the file type classification, and the dependency relationship score, through a preset decision model, and to execute the cleanup control instructions by calling the file operation interface.

9. An automatic file cleaning device, characterized in that, The automatic file cleaning device includes a processor, a memory, and an automatic file cleaning program stored in the memory and executable by the processor, wherein when the automatic file cleaning program is executed by the processor, it implements the steps of the automatic file cleaning method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an automatic file cleanup program, wherein when the automatic file cleanup program is executed by a processor, it implements the steps of the automatic file cleanup method as described in any one of claims 1 to 7.