Automatic file cleaning method, device, equipment and storage medium

By building a regression function to automatically judge and process files, the problem of low file cleaning efficiency in the file system is solved, and automated cleaning is realized, reducing labor costs and capacity expansion time.

CN114238233BActive Publication Date: 2024-11-05CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111544146.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2024-11-05
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

The file cleaning efficiency of existing file systems is inefficient after storage, and requires manual expansion or organization, resulting in high cost and low efficiency, and the file system cannot be used normally during expansion and processing.

Method used

By obtaining historical file cleaning information, it is divided into cleaning information based on storage time and last access time, a regression function is constructed to automatically judge and process the files to be cleaned, and the files are automatically cleaned are realized.

Benefits of technology

It improves the efficiency of file cleaning, reduces manual intervention and capacity expansion costs, and ensures the normal operation of the file system during the cleaning process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238233B_ABST
    Figure CN114238233B_ABST
Patent Text Reader

Abstract

The present invention relates to data processing technology, and discloses a method for automatic file cleaning, including: dividing historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time, and extracting data corresponding to each cleaning information to obtain a first data set and a second data set, and constructing a first cleaning function and a second cleaning function; judging whether the file data of a file to be cleaned belongs to the cleaning information based on storage duration or the cleaning information based on last access time; if it is the former, using the first cleaning function to calculate the cleaning result of the file to be cleaned; if it is the latter, using the second cleaning function to calculate the cleaning result of the file to be cleaned; when the cleaning result is cleaning, cleaning the file to be cleaned. The present invention also relates to blockchain technology, and file data can be stored in a node of a blockchain. The present invention also proposes a device, equipment and medium for automatic file cleaning. The present invention can improve the efficiency of file cleaning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to an automatic file cleaning method, device, electronic device and computer-readable storage medium. Background Art

[0002] After the files in the existing file system are stored, they will remain until the file system capacity cannot accommodate them, unless the program policy forcibly specifies deletion. When the file system capacity cannot accommodate them, it is necessary to manually expand the file server size, which increases costs; or manually organize and clean up unused files, resulting in increased labor costs. The timeliness of file system expansion and manual maintenance is slow and costly, and during the expansion and manual processing process, the file system will be in a state where it cannot be used normally, resulting in low efficiency in file cleaning. Summary of the invention

[0003] The present invention provides a method and device for automatically cleaning files, and a computer-readable storage medium, the main purpose of which is to solve the problem of low efficiency in file cleaning.

[0004] To achieve the above object, the present invention provides a method for automatically cleaning files, comprising:

[0005] Acquire historical file cleaning information, and divide the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time;

[0006] Respectively extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain a first data set and a second data set;

[0007] Constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function;

[0008] Acquire file data of the file to be cleaned, and determine whether the file data of the file to be cleaned belongs to cleaning information based on storage duration or cleaning information based on last access time;

[0009] If the file to be cleaned belongs to information to be cleaned based on storage duration, the cleaning result of the file to be cleaned is calculated by using the first cleaning function;

[0010] If the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the last access time, the cleaning result of the to-be-cleaned file is calculated by using the second cleaning function;

[0011] When the cleaning result of the file to be cleaned is cleaned, the file to be cleaned is cleaned.

[0012] Optionally, dividing the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time includes:

[0013] Extracting the cleaning attributes of each cleaning information in the historical file cleaning information one by one;

[0014] Determine whether the cleaning attribute is storage duration cleaning or last access time cleaning;

[0015] If the cleaning attribute is storage duration cleaning, determining that the cleaning information is storage duration-based cleaning information;

[0016] If the cleaning attribute is last access time cleaning, it is determined that the cleaning information is cleaning information based on the last access time.

[0017] Optionally, respectively extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain the first data set and the second data set includes:

[0018] Extracting one of the cleaning information based on the storage duration one by one as the first target cleaning information;

[0019] Extracting one of the cleaning information based on the last access time one by one as the second target cleaning information;

[0020] Extracting data from the first target cleaning information and the second target cleaning information respectively according to preset tags to obtain first data and second data;

[0021] The first data and the label corresponding to the first data, and the second data and the label corresponding to the second data are associated and stored in the first data set and the second data set.

[0022] Optionally, constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function includes:

[0023] Extracting labels of the first data set and labels of the second data set respectively to obtain a first data label set and a second data label set;

[0024] Calculate the unknown coefficients in the first regression function according to the preset first regression function and the data corresponding to each label in the first data label set;

[0025] Calculate the unknown coefficients in the second regression function according to the preset second regression function and the data corresponding to each label in the second data label set;

[0026] Substituting the unknown coefficients in the first regression function into the first regression function to obtain a first cleaning function;

[0027] Substitute the unknown coefficients in the second regression function into the second regression function to obtain a second cleaning function.

[0028] Optionally, the determining whether the file data of the to-be-cleaned file belongs to cleaning information based on storage duration or cleaning information based on last access time includes:

[0029] Calculating the distance value between the file data and each label in the first data label set one by one to obtain a first distance value set, and calculating the distance value between the file data and each label in the second data label set one by one to obtain a second distance value set;

[0030] respectively calculating the mean of the first distance value set and the second distance value set;

[0031] When the result calculated by the first distance value set is greater than the result calculated by the second distance value set, determining that the file data of the file to be cleaned is cleaning information based on storage duration;

[0032] When the result of calculating the first distance value set is less than or equal to the result of calculating the second distance value set, it is determined that the file data of the file to be cleaned is cleanup information based on the last access time.

[0033] Optionally, the determining whether the file data of the to-be-cleaned file belongs to cleaning information based on storage duration or cleaning information based on last access time includes:

[0034] Identify a preset cleaning information type identifier of the file to be cleaned;

[0035] It is determined according to the cleaning information type identifier whether the file data of the file to be cleaned belongs to the cleaning information based on the storage duration or the cleaning information based on the last access time.

[0036] Optionally, obtaining historical file cleaning information includes:

[0037] Get the storage path of historical file cleanup information;

[0038] The storage path is compiled into a path parameter, a preset data interface is assigned using the path parameter, and the historical file cleaning information is called using the assigned data interface.

[0039] In order to solve the above problems, the present invention also provides a file automatic cleaning device, the device comprising:

[0040] A historical file cleaning information classification module is used to obtain historical file cleaning information and classify the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time;

[0041] A data set generation module, used to extract data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time, to obtain a first data set and a second data set;

[0042] A cleaning function generating module, used for constructing regression functions for the first data set and the second data set respectively, to obtain a first cleaning function and a second cleaning function;

[0043] The file-to-be-cleaned cleaning module is used to obtain file data of the file to be cleaned. If the file to be cleaned belongs to the information to be cleaned based on the storage duration, the cleaning result of the file to be cleaned is calculated by using the first cleaning function; if the file data of the file to be cleaned belongs to the information to be cleaned based on the last access time, the cleaning result of the file to be cleaned is calculated by using the second cleaning function; when the cleaning result of the file to be cleaned is clean, the file to be cleaned is cleaned.

[0044] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0045] at least one processor; and,

[0046] a memory communicatively connected to the at least one processor; wherein,

[0047] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned automatic file cleaning method.

[0048] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned automatic file cleaning method.

[0049] The embodiment of the present invention extracts and analyzes the data of historical file information to construct a regression function, and uses the constructed function to judge and process the acquired files to be cleaned, thereby realizing automatic data cleaning and improving the efficiency of file cleaning. Therefore, the automatic file cleaning method, device, electronic device and computer-readable storage medium proposed in the present invention can solve the problem of low efficiency of file cleaning. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A schematic diagram of a flow chart of an automatic file cleaning method provided by an embodiment of the present invention;

[0051] Figure 2 A schematic diagram of a process for obtaining a first data set and a second data set provided in an embodiment of the present invention;

[0052] Figure 3 A schematic diagram of a flow chart of obtaining a first cleaning function and a second cleaning function provided by an embodiment of the present invention;

[0053] Figure 4 A functional module diagram of an automatic file cleaning device provided by an embodiment of the present invention;

[0054] Figure 5 A schematic diagram of the structure of an electronic device for implementing the automatic file cleaning method provided by one embodiment of the present invention.

[0055] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0057] The embodiment of the present application provides a method for automatic file cleaning. The execution subject of the method for automatic file cleaning includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the method for automatic file cleaning can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.

[0058] Reference Figure 1 FIG. 1 is a flow chart of an automatic file cleaning method provided by an embodiment of the present invention. In this embodiment, the automatic file cleaning method includes:

[0059] S1. Obtain historical file cleaning information, and divide the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time;

[0060] In an embodiment of the present invention, the historical file cleaning information includes a file cleaning log formed by a computer actively performing a cleaning operation, and a file cleaning record formed by manually triggering the cleaning operation; the file cleaning log and the file cleaning record can both include different cleaning types, including cleaning information based on storage duration and cleaning information based on last access time.

[0061] In the embodiment of the present invention, the cleaning information based on storage time and the cleaning information based on last access time can be two types of cleaning information formed according to different cleaning types. The cleaning information based on storage time refers to files that are cleaned up based on the storage time of the files, and the related cleaning information of the files; the cleaning information based on last access time refers to files that are cleaned up based on the last access time of the files, and the related cleaning information of the files.

[0062] In the embodiment of the present invention, the obtaining of historical file cleaning information includes:

[0063] Get the storage path of historical file cleanup information;

[0064] The storage path is compiled into a path parameter, a preset data interface is assigned using the path parameter, and the historical file cleaning information is called using the assigned data interface.

[0065] In detail, the storage path may be uploaded in advance by personnel such as management personnel who are capable of processing files.

[0066] Specifically, an embodiment of the present invention can use a preset compiler to compile the storage path into path parameters, and use the path parameters to assign values ​​to a preset data interface, which can be used to call the data under the storage path, wherein the compiler includes but is not limited to: Microsoft Visual Studio, Dev-C++, C++Builder, Emacs+GC.

[0067] In an embodiment of the present invention, the historical file cleaning information is divided into cleaning information based on storage duration and cleaning information based on last access time, including:

[0068] Extracting the cleaning attributes of each cleaning information in the historical file cleaning information one by one;

[0069] Determine whether the cleaning attribute is storage duration cleaning or last access time cleaning;

[0070] If the cleaning attribute is storage duration cleaning, determining that the cleaning information is storage duration-based cleaning information;

[0071] If the cleaning attribute is last access time cleaning, it is determined that the cleaning information is cleaning information based on the last access time.

[0072] S2, respectively extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain a first data set and a second data set;

[0073] In an embodiment of the present invention, the cleaning information based on storage duration and the cleaning information based on last access time may include a file and related cleaning information of the file. The file refers to the cleaned file. Further, the related cleaning information of the file may include the file storage path, storage time, last access time, cleaning time, etc.

[0074] In the embodiment of the present invention, please refer to Figure 2 As shown, the data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time are respectively extracted to obtain the first data set and the second data set, including:

[0075] S21, extracting one of the cleaning information based on the storage duration one by one as the first target cleaning information;

[0076] S22, extracting one of the cleaning information based on the last access time one by one as the second target cleaning information;

[0077] S23, extracting data from the first target cleaning information and the second target cleaning information respectively according to preset tags to obtain first data and second data;

[0078] S24: associate and store the first data and the label corresponding to the first data, and the second data and the label corresponding to the second data in the first data set and the second data set.

[0079] In an embodiment of the present invention, the label used to extract data from the first target cleaning information and the label used to extract data from the second target cleaning information may be different. For example, the label used to extract data from the first target cleaning information may be storage time, last access time, cleaning time; and the label used to extract data from the second target cleaning information may be last access time, cleaning time, etc.

[0080] Furthermore, the embodiment of the present invention can also construct a balanced binary tree, a B-tree, etc. according to the first data set and the second data set. By constructing a tree data structure, it is convenient to clearly display the mapping relationship between data and labels.

[0081] S3, constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function;

[0082] In the embodiment of the present invention, the regression function can be constructed by a linear regression learning algorithm.

[0083] In an embodiment of the present invention, the first cleaning function is a cleaning function constructed based on data in the cleaning information based on storage duration, and the first cleaning function can be used to process data belonging to the cleaning information based on storage duration; the second cleaning function is a cleaning function constructed based on data in the cleaning information based on the last access time, and the second cleaning function can be used to process data belonging to the cleaning information based on the last access time.

[0084] In the embodiment of the present invention, please refer to Figure 3 As shown, the step of constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function includes:

[0085] S31, extracting labels of the first data set and labels of the second data set respectively to obtain a first data label set and a second data label set;

[0086] S32, calculating the unknown coefficients in the first regression function according to the preset first regression function and the data corresponding to each label in the first data label set;

[0087] S33, calculating the unknown coefficients in the second regression function according to the preset second regression function and the data corresponding to each label in the second data label set;

[0088] S34, substituting the unknown coefficients in the first regression function into the first regression function to obtain a first cleaning function;

[0089] S35. Substitute the unknown coefficients in the second regression function into the second regression function to obtain a second cleaning function.

[0090] For example, the first regression function is y=B_0+B_1x, where y is the data corresponding to the label of the cleaning result, x is the data corresponding to the labels other than the cleaning result in the first data label set, and B_0 and B_1 are unknown coefficients; assuming that there are data corresponding to the labels of storage time, last access time, cleaning time and cleaning result in the first data set, substitute the above data into the first regression function, and when the variables y and x are known values, use the linear regression algorithm to learn and calculate the unknown coefficients, and the first cleaning function can be obtained by determining the unknown coefficients.

[0091] S4, obtaining file data of the file to be cleaned up, and determining whether the file data of the file to be cleaned up belongs to cleaning information based on storage duration or cleaning information based on last access time;

[0092] In an embodiment of the present invention, a computer statement with a data capture function (such as a Java statement, a Python statement, etc.) can be used to obtain the file data of the file to be cleaned from a pre-built storage area for storing various file information, and the storage area includes but is not limited to a database, a blockchain node, a network cache, etc.

[0093] In an embodiment of the present invention, the determining whether the file data of the to-be-cleaned file belongs to cleaning information based on storage duration or cleaning information based on last access time includes:

[0094] Extracting labels of the first data set and labels of the second data set respectively to obtain a first data label set and a second data label set;

[0095] Calculating the distance value between the file data and each label in the first data label set one by one to obtain a first distance value set, and calculating the distance value between the file data and each label in the second data label set one by one to obtain a second distance value set;

[0096] respectively calculating the mean of the first distance value set and the second distance value set;

[0097] When the result calculated by the first distance value set is greater than the result calculated by the second distance value set, determining that the file data of the file to be cleaned is cleaning information based on storage duration;

[0098] When the result of calculating the first distance value set is less than or equal to the result of calculating the second distance value set, it is determined that the file data of the file to be cleaned is cleanup information based on the last access time.

[0099] For example, assuming that there are cleaning data 1 and cleaning data 2 in the file to be cleaned, there are labels A and label B in the first data label set, and there are labels C and label D in the second data label set, the distance values ​​with labels A, B, C and D are calculated using cleaning data 1 and cleaning data 2 respectively, and 90, 20, 20, 10, 60, 30, 40 and 50 are obtained. Therefore, the first distance value set has data 90, 20, 60 and 30; the second distance value set has data 20, 10, 40 and 50. By calculating the average value of the values ​​of the first distance value set and the second distance value set, it can be obtained that the average value of the first distance value set is 50 and the average value of the second distance value set is 30, so it is determined that the data of the file to be cleaned belongs to the cleaning information based on storage duration.

[0100] In another optional embodiment of the present invention, the determining, based on the file data, whether the file data of the file to be cleaned belongs to cleaning information based on storage duration or cleaning information based on last access time includes:

[0101] Identify a preset cleaning information type identifier of the file to be cleaned;

[0102] It is determined according to the cleaning information type identifier whether the file data of the file to be cleaned belongs to the cleaning information based on the storage duration or the cleaning information based on the last access time.

[0103] Specifically, the file to be cleaned can have a cleaning type identifier set by the administrator, and the system can identify the cleaning type identifier and then determine whether the file data of the file to be cleaned belongs to the cleaning information based on the storage duration or the cleaning information based on the last access time; if there is no cleaning type identifier for the file to be cleaned, the file data tag of the file to be cleaned can be used to determine whether it belongs to the cleaning information based on the storage duration or the cleaning information based on the last access time.

[0104] If the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the storage duration, executing S5, calculating and obtaining the cleaning result of the to-be-cleaned file by using the first cleaning function;

[0105] In the embodiment of the present invention, the cleaning result of the file to be cleaned is calculated by using the first cleaning function. The file data of each file to be cleaned is substituted into the first cleaning function to obtain multiple calculation results respectively, and the multiple calculation results are statistically or calculated to determine the cleaning result of the file to be cleaned.

[0106] For example, suppose that the file data of the file to be cleaned is substituted into the first cleaning function and the calculation results are: 0.8, 0.4, and 0.6. If the calculation results are counted, those greater than or equal to 0.5 are considered to be cleaned, and those less than 0.5 are considered not to be cleaned, then the cleaning result is cleaned; if the calculation results are calculated (average value), the calculated result is 0.6, and the calculation result greater than or equal to 0.5 is considered to be cleaned, then the cleaning result is cleaned.

[0107] If the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the last access time, executing S6, calculating and obtaining the cleaning result of the to-be-cleaned file by using the second cleaning function;

[0108] In the embodiment of the present invention, the step of using the second cleaning function to calculate the cleaning result of the file to be cleaned is the same as the step of using the first cleaning function to calculate the cleaning result of the file to be cleaned in the above S5, and will not be repeated here.

[0109] S7, determining whether the cleaning result of the file to be cleaned is cleaning;

[0110] When the cleaning result of the file to be cleaned is not to be cleaned, the cleaning is not performed and the process returns to S4;

[0111] In the embodiment of the present invention, if the cleaning result of the file to be cleaned is not to be cleaned, it means that the file to be cleaned does not belong to the cleaning category, and there is no need to perform a cleaning operation.

[0112] When the cleaning result of the to-be-cleaned file is clean, S8 is executed to clean the to-be-cleaned file.

[0113] In the embodiment of the present invention, if the cleaning result of the file to be cleaned is cleaning, it means that the file to be cleaned needs to be cleaned, and the system can perform cleaning operations such as deletion to clean the file to be cleaned.

[0114] In the embodiment of the present invention, the cleaned file data can also be used as historical data to continue the process of acquiring data and constructing functions according to the data, and using the constructed functions to process new data to be detected.

[0115] The embodiment of the present invention extracts and analyzes the data of historical file information to construct a regression function, and uses the constructed function to judge and process the acquired files to be cleaned, thereby realizing automatic data cleaning and improving the efficiency of file cleaning. Therefore, the automatic file cleaning method proposed by the present invention can solve the problem of low efficiency of file cleaning.

[0116] like Figure 4 , which is a functional module diagram of an automatic file cleaning device provided by an embodiment of the present invention.

[0117] The automatic file cleaning device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the automatic file cleaning device 100 can include a historical file cleaning information classification module 101, a data set generation module 102, a cleaning function generation module 103 and a to-be-cleaned file cleaning module 104. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0118] In this embodiment, the functions of each module / unit are as follows:

[0119] The historical file cleaning information classification module 101 is used to obtain historical file cleaning information and classify the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time;

[0120] The data set generation module 102 is used to extract data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time, respectively, to obtain a first data set and a second data set;

[0121] The cleaning function generating module 103 is used to construct regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function;

[0122] The to-be-cleaned file cleaning module 104 is used to obtain file data of the to-be-cleaned file. If the to-be-cleaned file belongs to the to-be-cleaned information based on the storage duration, the cleaning result of the to-be-cleaned file is calculated using the first cleaning function; if the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the last access time, the cleaning result of the to-be-cleaned file is calculated using the second cleaning function; when the cleaning result of the to-be-cleaned file is clean, the to-be-cleaned file is cleaned.

[0123] In detail, each module described in the automatic file cleaning device 100 of the embodiment of the present invention is used in the same manner as described above. Figures 1 to 3 The technical means are the same as the automatic file cleaning method described in, and can produce the same technical effects, so they will not be repeated here.

[0124] like Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing an automatic file cleaning method provided by an embodiment of the present invention.

[0125] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as an automatic file cleaning program.

[0126] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a file automatic cleaning program, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0127] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can be used not only to store application software and various types of data installed in the electronic device, such as the code of the file automatic cleaning program, but also to temporarily store data that has been output or is to be output.

[0128] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0129] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0130] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0131] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0132] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0133] The automatic file cleaning program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0134] Acquire historical file cleaning information, and divide the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time;

[0135] Respectively extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain a first data set and a second data set;

[0136] Constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function;

[0137] Acquire file data of the file to be cleaned, and determine whether the file data of the file to be cleaned belongs to cleaning information based on storage duration or cleaning information based on last access time;

[0138] If the file to be cleaned belongs to information to be cleaned based on storage duration, the cleaning result of the file to be cleaned is calculated by using the first cleaning function;

[0139] If the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the last access time, the cleaning result of the to-be-cleaned file is calculated by using the second cleaning function;

[0140] When the cleaning result of the file to be cleaned is cleaned, the file to be cleaned is cleaned.

[0141] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.

[0142] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0143] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0144] Acquire historical file cleaning information, and divide the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time;

[0145] Respectively extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain a first data set and a second data set;

[0146] Constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function;

[0147] Acquire file data of the file to be cleaned, and determine whether the file data of the file to be cleaned belongs to cleaning information based on storage duration or cleaning information based on last access time;

[0148] If the file to be cleaned belongs to information to be cleaned based on storage duration, the cleaning result of the file to be cleaned is calculated by using the first cleaning function;

[0149] If the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the last access time, the cleaning result of the to-be-cleaned file is calculated by using the second cleaning function;

[0150] When the cleaning result of the file to be cleaned is cleaned, the file to be cleaned is cleaned.

[0151] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0152] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0153] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0154] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0155] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0156] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0157] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for automatic file cleaning, characterized in that: The method comprises: Acquire historical file cleaning information, and divide the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time; Respectively extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain a first data set and a second data set; Constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function; Acquire file data of the file to be cleaned, and determine whether the file data of the file to be cleaned belongs to cleaning information based on storage duration or cleaning information based on last access time; If the file to be cleaned belongs to information to be cleaned based on storage duration, the cleaning result of the file to be cleaned is calculated by using the first cleaning function; If the file data of the to-be-cleaned file belongs to the to-be-cleaned information based on the last access time, the cleaning result of the to-be-cleaned file is calculated by using the second cleaning function; When the cleaning result of the file to be cleaned is cleaned, cleaning the file to be cleaned; Among them, constructing regression functions for the first data set and the second data set respectively to obtain a first cleaning function and a second cleaning function includes: extracting the label of the first data set and the label of the second data set respectively to obtain a first data label set and a second data label set; calculating the unknown coefficients in the first regression function according to the preset first regression function and the data corresponding to each label in the first data label set; calculating the unknown coefficients in the second regression function according to the preset second regression function and the data corresponding to each label in the second data label set; substituting the unknown coefficients in the first regression function into the first regression function to obtain a first cleaning function; substituting the unknown coefficients in the second regression function into the second regression function to obtain a second cleaning function.

2. The automatic file cleaning method according to claim 1, characterized in that: The historical file cleaning information is divided into cleaning information based on storage duration and cleaning information based on last access time, including: Extracting the cleaning attributes of each cleaning information in the historical file cleaning information one by one; Determine whether the cleaning attribute is storage duration cleaning or last access time cleaning; If the cleaning attribute is storage duration cleaning, determining that the cleaning information is storage duration-based cleaning information; If the cleaning attribute is last access time cleaning, it is determined that the cleaning information is cleaning information based on the last access time.

3. The automatic file cleaning method according to claim 1, characterized in that: The extracting data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time to obtain the first data set and the second data set includes: Extracting one of the cleaning information based on the storage duration one by one as the first target cleaning information; Extracting one of the cleaning information based on the last access time one by one as the second target cleaning information; Extracting data from the first target cleaning information and the second target cleaning information respectively according to preset tags to obtain first data and second data; The first data and the label corresponding to the first data, and the second data and the label corresponding to the second data are associated and stored in the first data set and the second data set.

4. The automatic file cleaning method according to claim 1, characterized in that: The determining whether the file data of the to-be-cleaned file belongs to cleaning information based on storage duration or cleaning information based on last access time includes: Calculating the distance value between the file data and each label in the first data label set one by one to obtain a first distance value set, and calculating the distance value between the file data and each label in the second data label set one by one to obtain a second distance value set; respectively calculating the mean of the first distance value set and the second distance value set; When the result calculated by the first distance value set is greater than the result calculated by the second distance value set, determining that the file data of the file to be cleaned is cleaning information based on storage duration; When the result of calculating the first distance value set is less than or equal to the result of calculating the second distance value set, it is determined that the file data of the file to be cleaned is cleanup information based on the last access time.

5. The automatic file cleaning method according to claim 1, characterized in that: The determining whether the file data of the to-be-cleaned file belongs to cleaning information based on storage duration or cleaning information based on last access time includes: Identify a preset cleaning information type identifier of the file to be cleaned; It is determined according to the cleaning information type identifier whether the file data of the file to be cleaned belongs to the cleaning information based on the storage duration or the cleaning information based on the last access time.

6. The automatic file cleaning method according to any one of claims 1 to 5, characterized in that: The obtaining of historical file cleaning information includes: Get the storage path of historical file cleanup information; The storage path is compiled into a path parameter, a preset data interface is assigned using the path parameter, and the historical file cleaning information is called using the assigned data interface.

7. An automatic file cleaning device, used to implement the automatic file cleaning method according to any one of claims 1 to 6, characterized in that: The device comprises: A historical file cleaning information classification module is used to obtain historical file cleaning information and classify the historical file cleaning information into cleaning information based on storage duration and cleaning information based on last access time; A data set generation module, used to extract data corresponding to each of the cleaning information based on the storage duration and the cleaning information based on the last access time, to obtain a first data set and a second data set; A cleaning function generating module, used for constructing regression functions for the first data set and the second data set respectively, to obtain a first cleaning function and a second cleaning function; The file-to-be-cleaned cleaning module is used to obtain file data of the file to be cleaned. If the file to be cleaned belongs to the information to be cleaned based on the storage duration, the cleaning result of the file to be cleaned is calculated by using the first cleaning function; if the file data of the file to be cleaned belongs to the information to be cleaned based on the last access time, the cleaning result of the file to be cleaned is calculated by using the second cleaning function; when the cleaning result of the file to be cleaned is clean, the file to be cleaned is cleaned.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the automatic file cleaning method as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the automatic file cleaning method according to any one of claims 1 to 6 is implemented.