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

By recording and counting the file information deleted by users, generating a cleaning sequence, and calculating the cleaning score to decide whether to delete the target file, the problem of inaccurate file cleaning in the existing technology is solved, and efficient and accurate file cleaning is achieved.

CN113688104BActive Publication Date: 2025-06-20JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110856472.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-28
Publication Date
2025-06-20
Estimated Expiration
2041-07-28

AI Technical Summary

Technical Problem

Existing file cleaning tools are difficult to accurately locate the files that users want to delete, which may lead to accidentally deletion of files or useless files that are not deleted.

Method used

By recording the file information deleted by users in real time, counting and sorting this information, a cleaning sequence is generated. Then, the cleaning score is calculated based on the arrangement position of the target file information in the cleaning sequence to decide whether to delete the target file.

Benefits of technology

It improves the accuracy of file cleaning, reduces the probability of file deletion, ensures that truly useless files are cleaned up in time, and improves operation and maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113688104B_ABST
    Figure CN113688104B_ABST
Patent Text Reader

Abstract

The present application discloses a file cleaning method, apparatus, device and readable storage medium. The method disclosed in the present application includes: recording in real time first file information of deleted files deleted by a user; arranging the first file information in a first sequence according to the number of occurrences of the first file information among all the recorded deleted files; if a cleaning time point is reached, obtaining second file information of any target file existing in the current device, which is of the same category as the first file information; if the second file information exists in the first sequence, determining a cleaning score corresponding to the arrangement position of the second file information in the first sequence, and determining whether to delete the target file according to the cleaning score. The present application can locate the files that the user really wants to delete based on the user's file deletion behavior, conform to the user's cleaning habits, and reduce the probability of files being accidentally deleted. A file cleaning apparatus, device and readable storage medium provided by the present application also have the above technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and particularly to a file cleaning method, apparatus, device and readable storage medium. Background Art

[0002] Currently, the usage of servers is increasing day by day. With the long-term use of servers, a large number of file resource fragments will be generated. The file resource fragments generated by the server will not only occupy a large amount of hard disk space, but also consume a large amount of operation and maintenance time. Some general file cleaning tools can be used to clean the files in the server, but generally they can only locate the files to be cleaned in conventional ways such as the least recently used. However, in fact, the least recently used files are not necessarily the files that the user wants to delete. Therefore, using general file cleaning tools may lead to accidental deletion of files, while the truly useless files are not deleted.

[0003] Therefore, how to locate the files that the user wants to delete and clean these files in time is a problem that those skilled in the art need to solve. Summary of the Invention

[0004] In view of this, the purpose of the present application is to provide a file cleaning method, apparatus, device and readable storage medium to locate the files that the user wants to delete and clean these files in time. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a file cleaning method, including:

[0006] Real-time record the first file information of the deleted files deleted by the user;

[0007] Count the number of occurrences of the first file information in all the recorded deleted files, and arrange the first file information according to the size of the number of occurrences to obtain a first sequence;

[0008] If the cleaning time point is reached, obtain the second file information of any target file existing in the current device; the category of the first file information is the same as that of the second file information;

[0009] If the second file information exists in the first sequence, determine the cleaning score corresponding to the arrangement position of the second file information in the first sequence, and determine whether to delete the target file according to the cleaning score.

[0010] Preferably, the step of counting the number of occurrences of the first file information in all the recorded deleted files and arranging the first file information according to the size of the number of occurrences to obtain a first sequence includes:

[0011] If the first file information is a file type, count the number of occurrences of each file type among all the recorded deleted files, and arrange each file type in descending order of the number of occurrences of the type to obtain a type sequence;

[0012] If the first file information is a file path, count the number of occurrences of each file path among all the recorded deleted files, and arrange each file path in descending order of the number of occurrences of the path to obtain a path sequence;

[0013] If the first file information is the word segmentation of a file name, count the number of occurrences of each word segmentation among all the recorded deleted files, and arrange each word segmentation in descending order of the number of occurrences of the word segmentation to obtain a word segmentation sequence;

[0014] Use the type sequence and / or the path sequence and / or the word segmentation sequence as the first sequence.

[0015] Preferably, if the second file information exists in the first sequence, determining the cleaning score corresponding to the arrangement position of the second file information in the first sequence includes:

[0016] If the second file information is a file type, determine the cleaning score corresponding to the arrangement position of the file type of the target file in the type sequence;

[0017] If the second file information is a file path, determine the cleaning score corresponding to the arrangement position of the file path of the target file in the path sequence;

[0018] If the second file information is the word segmentation of a file name, determine the cleaning score corresponding to the arrangement position of the word segmentation of the file name of the target file in the word segmentation sequence.

[0019] Preferably, determining whether to delete the target file according to the cleaning score includes:

[0020] If the automatic cleaning function of the current device is enabled, in the case of only one cleaning score, determine whether the cleaning score is not less than a first threshold;

[0021] If so, automatically delete the target file;

[0022] If not, display the target file.

[0023] Preferably, determining whether to delete the target file according to the cleaning score includes:

[0024] If the automatic cleaning function of the current device is enabled, in the case of at least two cleaning scores, obtain the cleaning weights corresponding to each cleaning score respectively;

[0025] Calculate the comprehensive score according to the first formula; the first formula is:

[0026]

[0027] where f s is the comprehensive score, n is the maximum permutation position in the type sequence and / or the path sequence and / or the word segmentation sequence, x is the number of cleaning scores, a1......a x are x cleaning scores, and S1......S x are the cleaning weights corresponding to each cleaning score respectively;

[0028] Determine whether the comprehensive score is not less than the second threshold;

[0029] If so, automatically delete the target file;

[0030] If not, display the target file.

[0031] Preferably, it further includes:

[0032] Use the scanning method to determine at least two files existing in the current device;

[0033] Arrange the at least two files respectively according to the file size and / or the file modification time and / or the file modification times to obtain a file size sequence and / or a modification time sequence and / or a modification times sequence;

[0034] Take any one of the at least two files as the target file, and determine the cleaning score corresponding to the permutation position of the target file in the file size sequence and / or the modification time sequence and / or the modification times sequence;

[0035] Correspondingly, the determining whether to delete the target file according to the cleaning score includes:

[0036] If the automatic cleaning function of the current device is enabled, then in the case of having at least two cleaning scores, obtain the cleaning weights corresponding to each cleaning score;

[0037] Calculate the comprehensive score according to the first formula; the first formula is:

[0038]

[0039] where f s is the comprehensive score, n is the maximum permutation position in the type sequence and / or the path sequence and / or the word segmentation sequence, and the file size sequence and / or the modification time sequence and / or the modification times sequence, x is the number of cleaning scores, a1......a xFor x cleaning scores, S1......S x are the cleaning weights corresponding to the respective cleaning scores;

[0040] Determine whether to delete each file according to the comprehensive score corresponding to each file in the at least two files.

[0041] Preferably, the determining whether to delete each file according to the comprehensive score corresponding to each file in the at least two files includes:

[0042] Record the comprehensive score corresponding to each file in the at least two files, and arrange the at least two files in descending order of the comprehensive score to obtain a list of files to be cleaned;

[0043] If there is a file in the list of files to be cleaned whose comprehensive score is not less than the second threshold, delete the file in the list of files to be cleaned whose comprehensive score is not less than the second threshold;

[0044] If there is no file in the list of files to be cleaned whose comprehensive score is not less than the second threshold, display the list of files to be cleaned.

[0045] In a second aspect, the present application provides a file cleaning device, including:

[0046] A recording module for real-time recording of the first file information of the deleted files deleted by the user;

[0047] A statistics module for counting the number of times the first file information appears in all the recorded deleted files, and arranging the first file information in descending order of the number of times to obtain a first sequence;

[0048] An acquisition module for acquiring the second file information of any target file existing in the current device if the cleaning time point is reached; the first file information and the second file information are of the same category;

[0049] A cleaning module for determining the cleaning score corresponding to the arrangement position of the second file information in the first sequence if the second file information exists in the first sequence, and determining whether to delete the target file according to the cleaning score.

[0050] In a third aspect, the present application provides an electronic device, including:

[0051] A memory for storing a computer program;

[0052] A processor for executing the computer program to implement the file cleaning method disclosed above.

[0053] Fourthly, the present application provides a readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the file cleaning method disclosed above is implemented.

[0054] As can be seen from the above solutions, the present application provides a file cleaning method, including: real-time recording of first file information of deleted files deleted by a user; counting the number of occurrences of the first file information among all the recorded deleted files, and arranging the first file information according to the magnitude of the number of occurrences to obtain a first sequence; if a cleaning time point is reached, obtaining second file information of any target file existing in the current device; the first file information and the second file information are of the same category; if the second file information exists in the first sequence, determining a cleaning score corresponding to the arrangement position of the second file information in the first sequence, and determining whether to delete the target file according to the cleaning score.

[0055] It can be seen that the present application can perform information statistics on the deleted files deleted by the user to obtain a first sequence. If the file information of any currently existing target file in the device appears in the first sequence, it indicates that the file information of the currently existing target file coincides with the file information of the deleted files deleted by the user. Then, the currently existing target file is very likely to be the file that the user also wants to delete. Therefore, determine the cleaning score corresponding to the arrangement position of the file information of the currently existing target file in the first sequence, and determine whether to delete the target file according to the cleaning score. This solution can count and record the file information of the files deleted by the user, and thereby search in the device for information identical to the file information of the deleted files, so as to determine the files that need to be deleted in the device. It is a file cleaning solution based on the user's file deletion behavior, which can locate the files that the user really wants to delete and clean these files in a timely manner. The files to be deleted located conform to the user's daily cleaning habits and are very likely to be the files that the user really wants to delete, which can reduce the probability of files being accidentally deleted, reduce complicated and long-term manual operations, and greatly improve the operation and maintenance efficiency.

[0056] Correspondingly, a file cleaning device, equipment and readable storage medium provided by the present application also have the above technical effects. Description of the Drawings

[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0058] Figure 1Flowchart of a file cleaning method disclosed in this application;

[0059] Figure 2 Schematic diagram of a file cleaning device disclosed in this application;

[0060] Figure 3 Schematic diagram of an electronic device disclosed in this application;

[0061] Figure 4 Flowchart of another file cleaning method disclosed in this application. Detailed implementation manners

[0062] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the protection scope of this application.

[0063] Currently, general file cleaning tools generally can only locate files to be cleaned in conventional ways such as least recently used. However, in fact, the least recently used files are not necessarily the files that the user wants to delete. Therefore, using general file cleaning tools may result in accidental deletion of files, while truly useless files are not deleted. For this reason, this application provides a file cleaning solution that can locate the files that the user wants to delete and clean these files in a timely manner.

[0064] See Figure 1 As shown, an embodiment of this application discloses a file cleaning method, which is applied to any device (such as: server, computer, etc.), and includes:

[0065] S101. Real-time record the first file information of the deleted files deleted by the user.

[0066] The deleted files deleted by the user are one or more, and each file has file information such as type (such as pdf, word, etc.), name, path, size, etc. Therefore, the first file information can be type, name, path, etc.

[0067] S102. Count the number of occurrences of the first file information in all the recorded deleted files, and arrange the first file information in descending order of the number of occurrences to obtain a first sequence.

[0068] If there are 6 recorded deleted files, namely 2 pdf files, 3 word files, and 1 xml file. Assuming that the first file information is the file type, then the first sequence is: [word, pdf, xml], and this sequence is the type sequence.

[0069] Accordingly, when the first file information is the word segmentation of a file path or a file name, the corresponding sequence can be obtained. For example, assume that the file names of 2 pdf files are both: Temporary File; the file names of 3 word files are both: Executive Charter; and the file name of 1 xml file is: Window Display Code. Then, perform word segmentation on "Temporary File", "Executive Charter", and "Window Display Code" respectively to obtain multiple word segments. Arrange these word segments in descending order of the number of occurrences to obtain the word segmentation sequence. Among them, the file name can be segmented based on NLP (Natural Language Processing), and can be processed separately according to the language type. For example, when the file name encounters English, perform English word segmentation; when it encounters Chinese, perform Chinese word segmentation.

[0070] In a specific implementation, count the number of occurrences of the first file information in all the recorded deleted files, and arrange the first file information in descending order of the number of occurrences to obtain the first sequence, including: if the first file information is the file type, count the number of type occurrences of each file type in all the recorded deleted files, and arrange each file type in descending order of the number of type occurrences to obtain the type sequence; if the first file information is the file path, count the number of path occurrences of each file path in all the recorded deleted files, and arrange each file path in descending order of the number of path occurrences to obtain the path sequence; if the first file information is the word segmentation of the file name, count the number of word segmentation occurrences of each word segment in all the recorded deleted files, and arrange each word segment in descending order of the number of word segmentation occurrences to obtain the word segmentation sequence; use the type sequence and / or the path sequence and / or the word segmentation sequence as the first sequence.

[0071] It can be seen that there are at most 3 first sequences, namely: the type sequence, the path sequence, and the word segmentation sequence; there is at least one, namely: the type sequence or the path sequence or the word segmentation sequence. Of course, there can also be 2 first sequences.

[0072] S103. If the cleaning time point is reached, obtain the second file information of any target file existing in the current device; the category of the first file information is the same as that of the second file information.

[0073] Among them, the category of the first file information being the same as that of the second file information means that: when the first file information is the file type, the second file information is also the file type; when the first file information is the file path, the second file information is also the file path; when the first file information is the word segmentation of the file name, the second file information is also the word segmentation of the file name.

[0074] S104. If there is second file information in the first sequence, determine the cleaning score corresponding to the arrangement position of the second file information in the first sequence, and determine whether to delete the target file according to the cleaning score.

[0075] In a specific implementation manner, if there is second file information in the first sequence, determining the cleaning score corresponding to the arrangement position of the second file information in the first sequence includes: if the second file information is the file type, determining the cleaning score corresponding to the arrangement position of the file type of the target file in the type sequence; if the second file information is the file path, determining the cleaning score corresponding to the arrangement position of the file path of the target file in the path sequence; if the second file information is the word segmentation of the file name, determining the cleaning score corresponding to the arrangement position of the word segmentation of the file name of the target file in the word segmentation sequence.

[0076] Since there can be multiple such first sequences, there can also be multiple cleaning scores. When there are 3 first sequences, namely the type sequence, the path sequence, and the word segmentation sequence respectively, there are also 3 corresponding cleaning scores.

[0077] In a specific implementation manner, determining whether to delete the target file according to the cleaning score includes: if the automatic cleaning function of the current device is enabled, in the case of only one cleaning score, determining whether the cleaning score is not less than the first threshold; if so, automatically deleting the target file; if not, displaying the target file. It can be seen that when the device's automatic cleaning function is enabled and there is only one cleaning score, the size relationship between the cleaning score and the first threshold can be directly judged. If the cleaning score is greater than the first threshold, it indicates that the target file is extremely similar to the deleted file, so the target file can be directly deleted; otherwise, the target file is displayed so that the user can confirm whether to delete the target file.

[0078] In a specific implementation manner, determining whether to delete the target file according to the cleaning score includes: if the automatic cleaning function of the current device is enabled, in the case of at least two cleaning scores, obtaining the cleaning weights corresponding to each cleaning score respectively;

[0079] Calculating the comprehensive score according to the first formula; the first formula is:

[0080]

[0081] where, f s is the comprehensive score, n is the maximum arrangement position in the type sequence and / or the path sequence and / or the word segmentation sequence, x is the number of cleaning scores, a1......a x are the x cleaning scores, and S1......S x are the cleaning weights corresponding to each cleaning score respectively;

[0082] Determine whether the comprehensive score is not less than the second threshold;

[0083] If so, automatically delete the target file;

[0084] If not, display the target file.

[0085] It can be seen that when the device enables the automatic cleaning function and there are at least two cleaning scores, the comprehensive score can be calculated according to the first formula, so as to determine whether to delete the target file based on the comprehensive score.

[0086] In this case, the value range of x in the first formula is: 1 ≤ x ≤ 3. When x = 3, and S1 corresponds to the type sequence, S2 corresponds to the path sequence, and S3 corresponds to the word segmentation sequence, S1 > S3 > S2. It can be seen that S1, S3, and S2 actually correspond to the type sequence, the path sequence, and the word segmentation sequence respectively, and their corresponding relationships and specific values can be flexibly adjusted according to the actual situation.

[0087] The cleaning score corresponding to any permutation position in any sequence can be: n - permutation position. For example: if the permutation position is the 2nd in the sequence, the cleaning score is: n - 2. It can be seen that in the type sequence, the path sequence, and the word segmentation sequence, the earlier the permutation position, the greater the cleaning score, and the easier it is to be deleted. This embodiment can judge any file existing in the current device, so as to determine whether it needs to be deleted.

[0088] It can be seen that this embodiment can perform information statistics on the deleted files deleted by the user, so as to obtain the first sequence. If the file information of any current target file existing in the device appears in the first sequence, it indicates that the file information of the current existing target file coincides with the file information of the deleted files deleted by the user. Then the current existing target file is very likely to be the file that the user also wants to delete. Therefore, determine the cleaning score corresponding to the permutation position of the file information of the current existing target file in the first sequence, and determine whether to delete the target file according to the cleaning score. This solution can count and record the file information of the files deleted by the user, and search for the information identical to the file information of the deleted files in the device based on this, so as to determine the files that need to be deleted in the device. It is a solution to clean files based on the user's behavior of deleting files, which can locate the files that the user really wants to delete and clean these files in time. The files to be deleted located meet the user's daily cleaning habits, are very likely to be the files that the user really wants to delete, can reduce the probability of files being deleted by mistake, reduce the complicated and long-term manual operations, and greatly improve the operation and maintenance efficiency.

[0089] Based on the above embodiments, it should be noted that if multiple files to be deleted are located at one time from all the files in the current device, then in one specific implementation, it further includes:

[0090] Determine at least two files existing in the current device (e.g., all files in the current device) by means of scanning;

[0091] Arrange at least two files respectively according to file size and / or file modification time and / or file modification count to obtain a file size sequence and / or a modification time sequence and / or a modification count sequence;

[0092] Take any one of the at least two files as a target file, and determine a cleaning score corresponding to the arrangement position of the target file in the file size sequence and / or the modification time sequence and / or the modification count sequence;

[0093] Accordingly, determine whether to delete the target file according to the cleaning score, including:

[0094] If the automatic cleaning function of the current device is enabled, then in the case of having at least two cleaning scores, obtain cleaning weights respectively corresponding to each cleaning score;

[0095] Calculate a comprehensive score according to the first formula; the first formula is:

[0096]

[0097] wherein, f s is the comprehensive score, n is the maximum arrangement position in the type sequence and / or the path sequence and / or the word segmentation sequence, and the file size sequence and / or the modification time sequence and / or the modification count sequence, x is the number of cleaning scores, a1......a x are x cleaning scores, and S1......S x are the cleaning weights respectively corresponding to each cleaning score;

[0098] Determine whether to delete each file according to the comprehensive score corresponding to each file among the at least two files.

[0099] Among them, determining whether to delete each file according to the comprehensive score corresponding to each file among the at least two files includes: recording the comprehensive score corresponding to each file among the at least two files, and arranging the at least two files in descending order of the comprehensive score to obtain a list to be cleaned; if there is a file in the list to be cleaned whose comprehensive score is not less than the second threshold, then delete the file in the list to be cleaned whose comprehensive score is not less than the second threshold; if there is no file in the list to be cleaned whose comprehensive score is not less than the second threshold, then display the list to be cleaned so that the user can select the files to be deleted therefrom.

[0100] It can be seen that when locating multiple files to be deleted at one time from all files in the current device, not only the relationship between each file and the deleted files needs to be considered, but also the relationship between each file and all files in the current device needs to be considered. Therefore, files can be cleared not only based on the user's file deletion behavior, but also whether the files to be cleared are really available in the current device.

[0101] Among them, at least two files are arranged in descending order of file size, so that larger files are arranged in the front, increasing the probability of large files being cleared, thereby increasing the available storage space. At least two files are arranged in ascending order of file modification time from early to late, so that the file with the longest modification time is arranged in the front, increasing the probability of the file with the longest modification time being cleared; the longest modification time of the file indicates that the file has not been used for a long time. At least two files are arranged in ascending order of the number of file modifications, so that files with fewer file modifications are arranged in the front, increasing the probability of such files being cleared; the fewer the number of file modifications, the lower the usage frequency of the file.

[0102] In this case, the value range of x in the first formula is: 2 ≤ x ≤ 6. Assume that x = 6, and S1 corresponds to the type sequence, S2 corresponds to the path sequence, S3 corresponds to the word segmentation sequence, S4 corresponds to the file size sequence, S5 corresponds to the file modification time sequence, and S6 corresponds to the file modification number sequence. Then S1 > S3 > S2, and at the same time, S4, S5, and S6 are preset and adjusted based on the user's requirements for storage space, file availability, etc. It can be seen that S1, S3, S2, S4, S5, and S6 actually correspond to the type sequence, path sequence, word segmentation sequence, file size sequence, modification time sequence, and modification number sequence respectively, and their corresponding relationships and specific values can be flexibly adjusted according to the actual situation.

[0103] Next, a file cleaning device provided by an embodiment of the present application will be introduced. The file cleaning device described below can be referred to each other with the file cleaning method described above.

[0104] See Figure 2 As shown, the second aspect of the embodiments of the present application is disclosed. The present application provides a file cleaning device, including:

[0105] A recording module 201 for real-time recording of the first file information of the deleted files deleted by the user;

[0106] A statistics module 202 for counting the number of occurrences of the first file information in all the recorded deleted files, and arranging the first file information in descending order of the number of occurrences to obtain a first sequence;

[0107] An acquisition module 203, configured to acquire second file information of any target file existing in the current device if a cleaning time point is reached; the first file information and the second file information are of the same category;

[0108] A cleaning module 204, configured to determine a cleaning score corresponding to the arrangement position of the second file information in the first sequence if the second file information exists in the first sequence, and determine whether to delete the target file according to the cleaning score.

[0109] In a specific embodiment, the statistics module includes:

[0110] A first statistics unit, configured to, if the first file information is a file type, count the number of occurrences of each file type in all the deleted files recorded, and arrange each file type in descending order of the number of occurrences of the type to obtain a type sequence;

[0111] A second statistics unit, configured to, if the first file information is a file path, count the number of occurrences of each file path in all the deleted files recorded, and arrange each file path in descending order of the number of occurrences of the path to obtain a path sequence;

[0112] A third statistics unit, configured to, if the first file information is a word segmentation of a file name, count the number of occurrences of each word segmentation in all the deleted files recorded, and arrange each word segmentation in descending order of the number of occurrences of the word segmentation to obtain a word segmentation sequence;

[0113] A determination unit, configured to use the type sequence and / or the path sequence and / or the word segmentation sequence as the first sequence.

[0114] In a specific embodiment, the cleaning module is specifically configured to:

[0115] If the second file information is a file type, determine a cleaning score corresponding to the arrangement position of the file type of the target file in the type sequence;

[0116] and / or

[0117] If the second file information is a file path, determine a cleaning score corresponding to the arrangement position of the file path of the target file in the path sequence;

[0118] and / or

[0119] If the second file information is a word segmentation of a file name, determine a cleaning score corresponding to the arrangement position of the word segmentation of the file name of the target file in the word segmentation sequence.

[0120] In a specific embodiment, the cleaning module is specifically configured to:

[0121] If the automatic cleaning function of the current device is enabled, then in the case of only one cleaning score, it is determined whether the cleaning score is not less than the first threshold;

[0122] If so, the target file is automatically deleted;

[0123] If not, the target file is displayed.

[0124] In a specific embodiment, the cleaning module is specifically configured to:

[0125] If the automatic cleaning function of the current device is enabled, then in the case of at least two cleaning scores, obtain the cleaning weights corresponding to each cleaning score respectively;

[0126] Calculate the comprehensive score according to the first formula; the first formula is:

[0127]

[0128] where, f s is the comprehensive score, n is the maximum permutation position in the type sequence and / or path sequence and / or word segmentation sequence, x is the number of cleaning scores, a1......a x are x cleaning scores, and S1......S x are the cleaning weights corresponding to each cleaning score respectively;

[0129] Determine whether the comprehensive score is not less than the second threshold;

[0130] If so, the target file is automatically deleted;

[0131] If not, the target file is displayed.

[0132] In a specific embodiment, it further includes:

[0133] A scanning module, configured to use a scanning method to determine at least two files existing in the current device;

[0134] An arranging module, configured to arrange at least two files according to file size and / or file modification time and / or file modification times respectively to obtain a file size sequence and / or a modification time sequence and / or a modification times sequence;

[0135] A determining module, configured to use any one of the at least two files as the target file, and determine the cleaning score corresponding to the permutation position of the target file in the file size sequence and / or the modification time sequence and / or the modification times sequence;

[0136] Correspondingly, the cleaning module is specifically configured to:

[0137] If the automatic cleaning function of the current device is enabled, when there are at least two cleaning scores, obtain the cleaning weights corresponding to each cleaning score respectively;

[0138] Calculate the comprehensive score according to the first formula; the first formula is:

[0139]

[0140] where, f s is the comprehensive score, n is the maximum permutation position in the type sequence and / or path sequence and / or word segmentation sequence, and file size sequence and / or modification time sequence and / or modification times sequence, x is the number of cleaning scores, a1......a x are x cleaning scores, S1......S x are the cleaning weights corresponding to each cleaning score respectively;

[0141] Determine whether to delete each file according to the comprehensive score corresponding to each file in at least two files.

[0142] In a specific implementation manner, the cleaning module is specifically used for:

[0143] Record the comprehensive score corresponding to each file in at least two files, and sort at least two files in descending order of the comprehensive score to obtain a list of files to be cleaned;

[0144] If there are files in the list of files to be cleaned whose comprehensive scores are not less than the second threshold, delete the files in the list of files to be cleaned whose comprehensive scores are not less than the second threshold;

[0145] If there are no files in the list of files to be cleaned whose comprehensive scores are not less than the second threshold, display the list of files to be cleaned.

[0146] Among them, for the more specific working processes of each module and unit in this embodiment, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details are not described herein again.

[0147] It can be seen that this embodiment provides a file cleaning device, which can locate the files that the user really wants to delete based on the user's file deletion behavior, conform to the user's cleaning habits, and reduce the probability of files being deleted by mistake.

[0148] Next, an electronic device provided by an embodiment of the present application will be introduced. The electronic device described below can be referred to each other with the file cleaning method and device described above.

[0149] See Figure 3 shown, an embodiment of the present application discloses an electronic device, including:

[0150] A memory 301 for storing a computer program;

[0151] A processor 302 is configured to execute the computer program to implement the method disclosed in any of the above embodiments.

[0152] Next, a readable storage medium provided in an embodiment of the present application will be introduced. The readable storage medium described below can be referred to in relation to the file cleaning method, device, and equipment described above.

[0153] A readable storage medium is used to store a computer program. When the computer program is executed by a processor, it implements the file cleaning method disclosed in the foregoing embodiments. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be elaborated herein.

[0154] If a management device is used to manage multiple devices simultaneously to clean files on these managed devices, first, a management terminal is set up, and modules such as behavior monitoring, scheduled scanning, recommendation calculation, file cleaning, and parameter configuration are set on the management terminal.

[0155] The behavior monitoring module is used to monitor the behavior of a user deleting files on any managed device and record the file type, file name, name segmentation (obtained after NLP segmentation of the file name), file path, etc. of the files deleted by the user. If the operating systems of different managed devices are different, monitoring is performed separately based on the operating system type. For example, the rm command is monitored for the linux system, and delete or shift+delete is monitored for the windows system.

[0156] The scheduled scanning module is used to periodically scan the existing files (files and directories other than system critical directories, such as the user directory, etc.) on any managed device and record the file name, name segmentation, file type, file size, file modification time, file modification count, etc. of the scanned files.

[0157] The recommendation calculation module is used to calculate the recommended value for each existing file to be cleaned.

[0158] The file cleaning module is used to sort according to the recommended value calculated by the recommendation calculation module and perform automatic deletion according to the threshold preset by the user. If the user does not enable the automatic deletion function, manual deletion can be performed.

[0159] The parameter configuration module is used to start and stop the automatic deletion function, the threshold of the automatic deletion function, the number and names of the managed devices (such as servers). Each weight value, maximum sorting position value, etc. involved in the recommendation calculation module. These parameters can be freely modified by the user.

[0160] Please refer to Figure 4 , and the specific implementation process is as follows:

[0161] (1) Start the parameter configuration module to configure the number of servers and server names, and generate the corresponding number of database tables named after the server names.

[0162] (2) Configure the maximum sorting value n, the timing scan interval t, the weight S1 of the deleted file type, the weight S2 of the deleted file path, the weight S3 of the word segmentation of the deleted file name, the weight S4 of the size of the existing file, the weight S5 of the modification time of the existing file, the weight S6 of the modification times of the existing file, and the automatic deletion threshold δ.

[0163] (3) Start the behavior monitoring module to monitor the user's file deletion behavior. For example, monitor the rm command in Linux and monitor delete and shift+delete in Windows, etc.

[0164] Among them, record the file type, file name, file path of the deleted file, and the word segmentation of the file name after NLP word segmentation, and record them in the database table in units of servers. If the file name is in Chinese, start the Chinese word segmentation engine (such as Ansj) for word segmentation. If the file name is in English, start the English word segmentation engine (such as NLTK) for word segmentation. Store each obtained word segmentation into the database. Repeated word segmentation is only recorded once, but the repetition times are also recorded.

[0165] (4) Start the timing scan module.

[0166] Taking time t as the unit, scan all file directories and files in the server except for the system critical directories, and record the file name, name word segmentation, file type, file size, file modification time, and file modification times, and record them in the database table in units of servers. The name word segmentation of the scanned files is recorded corresponding to each file, that is, one file corresponds to a set of word segmentations. If different files have repeated word segmentations, they are all recorded separately.

[0167] (5) Start the recommendation calculation module.

[0168] For the database table corresponding to any server, sort the file types of the deleted files in it from most occurrences to least occurrences, sort the file paths of the deleted files in it from most occurrences to least occurrences, and sort all the word segmentations of the deleted file names from most repeated times to least repeated times, and 3 sequences corresponding to the deleted files can be obtained. The sorting starts numbering from 1.

[0169] Scan the server corresponding to the current database table to obtain all the existing files in the server, sort these files from largest to smallest by file size, sort them from the earliest time by modification time, and sort them from the smallest by modification times, and 3 sequences corresponding to the existing files can be obtained. The sorting starts numbering from 1.

[0170] At this point, 6 sequences can be obtained. For any existing file in the server, determine whether the file type, file path, and name word segmentation of the existing file appear in any of the sequences corresponding to the deleted files. If so, determine the arrangement position and the corresponding recommended score; if not, judge the next existing file.

[0171] Suppose a certain existing file appears in 3 sequences corresponding to the deleted files, and its arrangement position in the file type sequence is b, then the corresponding recommended score is n - b; its arrangement position in the file path sequence is c, then the corresponding recommended score is n - c; its arrangement position in the word segmentation sequence is d, then the corresponding recommended score is n - d. At the same time, its arrangement position in the file size sequence is e, then the corresponding recommended score is n - e; its arrangement position in the modification time sequence is f, then the corresponding recommended score is n - f; its arrangement position in the modification times sequence is j, then the corresponding recommended score is n - j.

[0172] Let the total recommended score be f s , then adjust the recommended score accordingly based on the weights S1, S2, S3, S4, S5, S6, and there are: S1*(n - b), S2*(n - c), S3*(n - d), S4*(n - e), S5*(n - f), S6*(n - j). Then the total recommended score of this existing file is:

[0173]

[0174] Record f s and the name of the corresponding file into the recommended score table. If during the next scan, f s changes, record the latest value.

[0175] (6) Start the file cleaning module.

[0176] If f s ≥δ and the automatic deletion function is enabled, then delete the file; if f s <δ, then display the recommended list, sort it in descending order according to f s , and multiple selections for deletion are available.

[0177] (7) The cleaning of the recommended list is updated in real time with the recommended calculation results.

[0178] (8) If the automatic deletion function is started, files on different servers can be automatically deleted according to ⑧. If not, the user can choose to view the recommended lists of files on different servers and select files for deletion.

[0179] It can be seen that in this embodiment, one management terminal can clean the files on multiple devices simultaneously, and the cleaning is based on the user's behavior of deleting files, so that the files automatically cleaned by each server conform to the user's cleaning habits. The word segmentation of file names based on NLP parsing improves the accuracy of recommendation calculation. With scheduled scanning and automatic cleaning, users can complete the cleaning of server file fragments without manual operation. File cleaning no longer simply relies on manual maintenance, reducing complicated and long-term manual operations and greatly improving the operation and maintenance efficiency. At the same time, separate recommendation lists are provided for different servers, making differential processing more convenient and fast.

[0180] The "first", "second", "third", "fourth", etc. (if any) involved in this application are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described here can be implemented in an order different from that shown or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, or devices.

[0181] It should be noted that the descriptions involving "first", "second", etc. in this application are only for descriptive purposes and should not be construed as indicating or implying their relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one of such features. Additionally, the technical solutions between various embodiments can be combined with each other, but it must be based on the fact that those of ordinary skill in the art can implement them. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0182] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0183] The steps of the methods or algorithms described in combination with the embodiments disclosed in this article can be directly implemented by hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of readable storage medium known in the technical field.

[0184] In this text, specific examples are used to illustrate the principle and implementation of this application. The description of the above embodiments is only for helping to understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as a limitation to this application.

Claims

1. A file cleaning method, characterized in that, Including: Real-time recording the first file information of the deleted files deleted by the user; The first file information is type, name or path; Counting the number of occurrences of the first file information in all the recorded deleted files, and arranging the first file information in descending order of the number of occurrences to obtain a first sequence; If the cleaning time point is reached, obtaining the second file information of any target file existing in the current device; the category of the first file information is the same as that of the second file information; If the second file information exists in the first sequence, determining the cleaning score corresponding to the arrangement position of the second file information in the first sequence, and determining whether to delete the target file according to the cleaning score; the cleaning score corresponding to any arrangement position in any sequence is: n - arrangement position; n is the maximum arrangement position in the type sequence and / or path sequence and / or word segmentation sequence; the type sequence and / or path sequence and / or word segmentation sequence is the first sequence.

2. The file cleaning method according to claim 1, characterized in that, If the first file information is the file type, counting the number of type occurrences of each file type in all the recorded deleted files, and arranging each file type in descending order of the number of type occurrences to obtain a type sequence; If the first file information is the file path, counting the number of path occurrences of each file path in all the recorded deleted files, and arranging each file path in descending order of the number of path occurrences to obtain a path sequence; If the first file information is the word segmentation of the file name, counting the number of word segmentation occurrences of each word segmentation in all the recorded deleted files, and arranging each word segmentation in descending order of the number of word segmentation occurrences to obtain a word segmentation sequence.

3. The file cleaning method according to claim 2, characterized in that, The step of, if the second file information exists in the first sequence, determining the cleaning score corresponding to the arrangement position of the second file information in the first sequence, includes: If the second file information is the file type, determining the cleaning score corresponding to the arrangement position of the file type of the target file in the type sequence; If the second file information is the file path, determining the cleaning score corresponding to the arrangement position of the file path of the target file in the path sequence; If the second file information is the word segmentation of the file name, determining the cleaning score corresponding to the arrangement position of the word segmentation of the file name of the target file in the word segmentation sequence.

4. The file cleaning method according to claim 3, characterized in that, The step of determining whether to delete the target file according to the cleaning score includes: If the automatic cleaning function of the current device is enabled, in the case of only one cleaning score, determining whether the cleaning score is not less than a first threshold; If so, automatically deleting the target file; If not, displaying the target file.

5. The file cleaning method according to claim 3, characterized in that, The step of determining whether to delete the target file according to the cleaning score includes: If the automatic cleaning function of the current device is enabled, in the case of at least two cleaning scores, obtaining the cleaning weights corresponding to each cleaning score respectively; Calculating a comprehensive score according to a first formula; the first formula is: Among them, f s is the comprehensive score, n is the maximum permutation position in the type sequence and / or the path sequence and / or the word segmentation sequence, x is the number of cleaning scores, a1......a x are x cleaning scores, S1......S x are the cleaning weights respectively corresponding to the respective cleaning scores; Determining whether the comprehensive score is not less than a second threshold; If so, automatically deleting the target file; If not, displaying the target file.

6. The file cleaning method according to claim 3, characterized in that, Also including: Determine at least two files existing in the current device by means of scanning; Arrange the at least two files respectively according to file size and / or file modification time and / or file modification count to obtain a file size sequence and / or a modification time sequence and / or a modification count sequence; Take any one of the at least two files as the target file, and determine the cleaning score corresponding to the arrangement position of the target file in the file size sequence and / or the modification time sequence and / or the modification count sequence; Accordingly, the determining whether to delete the target file according to the cleaning score includes: If the automatic cleaning function of the current device is enabled, when there are at least two cleaning scores, obtain the cleaning weights corresponding to each cleaning score respectively; Calculate the comprehensive score according to the first formula; the first formula is: Among them, f s is the comprehensive score, n is the maximum permutation position in the type sequence and / or the path sequence and / or the word segmentation sequence, and the file size sequence and / or the modification time sequence and / or the modification times sequence, x is the number of cleaning scores, a1......a x are x cleaning scores, S1......S x are the cleaning weights corresponding to each cleaning score respectively; Determine whether to delete each file according to the comprehensive score corresponding to each file among the at least two files.

7. The file cleaning method according to claim 6, characterized in that, The determining whether to delete each file according to the comprehensive score corresponding to each file among the at least two files includes: Record the comprehensive score corresponding to each file among the at least two files, and arrange the at least two files in descending order according to the comprehensive score to obtain a list of files to be cleaned; If there are files in the list of files to be cleaned whose comprehensive scores are not less than the second threshold, delete the files in the list of files to be cleaned whose comprehensive scores are not less than the second threshold; If there are no files in the list of files to be cleaned whose comprehensive scores are not less than the second threshold, display the list of files to be cleaned.

8. A file cleaning device, characterized in that, It includes: A recording module, configured to record in real time the first file information of the deleted files deleted by the user; The first file information is type, name or path; A statistics module, configured to count the number of occurrences of the first file information in all the recorded deleted files, and arrange the first file information according to the size of the number of occurrences to obtain a first sequence; An obtaining module, configured to obtain the second file information of any target file existing in the current device if the cleaning time point is reached; the category of the first file information is the same as that of the second file information; A cleaning module, configured to if the second file information exists in the first sequence, determine the cleaning score corresponding to the arrangement position of the second file information in the first sequence, and determine whether to delete the target file according to the cleaning score; the cleaning score corresponding to any arrangement position in any sequence is: n - arrangement position; n is the maximum arrangement position in the type sequence and / or the path sequence and / or the word segmentation sequence; the type sequence and / or the path sequence and / or the word segmentation sequence is the first sequence.

9. An electronic device, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to execute the computer program to implement the file cleaning method according to any one of claims 1 to 7.

10. A readable storage medium, characterized in that, For saving a computer program, wherein the computer program, when executed by a processor, implements the file cleaning method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for cleaning up files

    CN103886059A

  • Display equipment, server, and file management method

    CN111782606A