File cleaning method and device, storage medium and electronic equipment
By scanning the files to obtain information, determining the simulation cleaning strategy according to the importance level, and simulated and cleaned the files, the problems of long and low efficiency in the existing technology are solved, and more efficient file cleaning is achieved.
Patent Information
- Application Number
- CN202311150852.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2025-03-07
AI Technical Summary
The prior art takes a long time to clean files and is inefficient.
By scanning the file, obtaining file information, determining the simulation cleaning strategy based on the importance level of the file, simulate and clean up the file, and outputting the cleanable files.
It reduces the time spent on file cleaning, improves file cleaning efficiency, and allows differentiated processing of files of different levels of importance.
Smart Images

Figure CN119576876A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic equipment, and in particular to a file cleaning method, device, storage medium and electronic equipment. Background Art
[0002] Electronic devices such as smartphones are becoming more and more versatile and can support more and more applications, such as communication applications, camera applications, browsers, shopping applications, game applications, applets, etc. These applications will generate various files when users use electronic devices, occupying a large amount of storage space on the electronic devices.
[0003] In order to save storage space of electronic devices, it is necessary to clean up files on the electronic devices regularly or irregularly. In the related art, when electronic devices clean up files, it takes a long time and the file cleaning efficiency is low. Summary of the invention
[0004] The embodiments of the present application provide a file cleaning method, device, storage medium and electronic device, which can reduce the time spent on file cleaning and improve the efficiency of file cleaning.
[0005] The present application provides a file cleaning method, including:
[0006] Scanning multiple files to be scanned to obtain file information of each file, wherein the file information is used to indicate the type of the file;
[0007] In response to a file cleaning request, determining an importance level of each file according to the file information of each file;
[0008] Processing the files according to the simulated cleaning strategy corresponding to the importance level of each file to obtain simulated cleaning results of the files, wherein files of different importance levels correspond to different simulated cleaning strategies;
[0009] Output the cleanable files among the multiple files according to the simulated cleaning result of each of the files.
[0010] The present application also provides a file cleaning device, including:
[0011] A scanning module, used for scanning a plurality of files to be scanned, and obtaining file information of each of the files, wherein the file information is used for indicating the type of the file;
[0012] A determination module, configured to determine the importance level of each file according to the file information of each file in response to a file cleaning request;
[0013] A processing module, used for processing the files according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file, wherein files of different importance levels correspond to different simulation cleaning strategies;
[0014] The output module is used to output the cleanable files among the multiple files according to the simulated cleaning results of each of the files.
[0015] An embodiment of the present application further provides a storage medium, wherein a computer program is stored in the storage medium. When the computer program is executed on a computer, the computer is enabled to execute the above-mentioned file cleaning method.
[0016] An embodiment of the present application also provides an electronic device, which includes a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the above-mentioned file cleaning method by running the computer program stored in the memory.
[0017] The file cleaning method of the embodiment of the present application can determine the importance level of each file, and process the file according to the simulation cleaning strategy corresponding to the importance level of the file. The simulation cleaning strategies corresponding to files of different importance levels are different, and thus the time required to process files of different importance levels is also different. Therefore, the file processing method is more flexible, and different files can be processed differently. There is no need to perform the same processing on a large number of files, thereby reducing the time spent on cleaning a large number of files and improving file cleaning efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings based on these drawings without creative work.
[0019] Figure 1 A schematic diagram of an application scenario of the file cleaning method of an embodiment of the present application.
[0020] Figure 2 This is a schematic diagram of the first flow chart of the file cleaning method according to an embodiment of the present application.
[0021] Figure 3 This is a first schematic diagram of processing a file in an embodiment of the present application.
[0022] Figure 4 This is a second schematic diagram of processing a file in an embodiment of the present application.
[0023] Figure 5 This is a second flow chart of the file cleaning method according to an embodiment of the present application.
[0024] Figure 6 This is a first schematic diagram of adding file information to the cache in batches in an embodiment of the present application.
[0025] Figure 7 This is a second schematic diagram of adding file information to the cache in batches in an embodiment of the present application.
[0026] Figure 8 This is a third schematic diagram of adding file information to the cache in batches in an embodiment of the present application.
[0027] Fig. 9 This is a first structural schematic diagram of the file cleaning device of an embodiment of the present application.
[0028] Fig.10 This is a second structural schematic diagram of the file cleaning device of an embodiment of the present application.
[0029] Fig.11 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0031] The present application embodiment provides a file cleaning method, which can be applied to electronic devices. The electronic devices can be smart phones, tablet computers, gaming devices, AR (Augmented Reality) devices, data storage devices, video playback devices, laptop computers, desktop computing devices, etc.
[0032] refer to Figure 1 , Figure 1 Schematic diagram of application scenario of the file cleaning method of the embodiment of the present application. The file cleaning method is applied to an electronic device, which stores a large number of files during the use of the user, for example, multiple files such as file a to file i. Among them, file a to file i may include various types of files such as system files, program files, log files, download files, cache files, media files, document files, etc. In order to save the storage space of the electronic device, it is necessary to clean up a large number of files stored in the electronic device regularly or irregularly.
[0033] In an example of practical application, the file cleaning method can be integrated into a file cleaning tool (SDK), or some implementation steps of the file cleaning method can be integrated into a file cleaning tool (SDK). The file cleaning tool (SDK) can be, for example, a mobile phone manager, or a module in a mobile phone manager. The file cleaning tool (SDK) can be used to clean up files on an electronic device regularly or irregularly to save storage space of the electronic device.
[0034] refer to Figure 2 , Figure 2 This is a first flow chart of the file cleaning method of the embodiment of the present application. The file cleaning method includes the following steps 110 to 140:
[0035] 110 , scanning multiple files to be scanned to obtain file information of each file.
[0036] When performing file cleaning, the electronic device first needs to scan multiple files to be scanned to obtain the file information of each file. Among them, the file information is used to indicate the type of the file. In practical applications, the types of files can be divided in many ways. For example, in a feasible example, the types of files can include system files, program files, log files, download files, cache files, media files, document files and other types. The electronic device can determine the type of the file through the attribute information of the file, or through information such as the file suffix, file format, etc.
[0037] In some implementations, the electronic device may automatically determine which files are to be scanned. For example, the electronic device may determine all files in a folder that occupy a storage space that reaches a set value (e.g., 300MB) as files to be scanned. For another example, the electronic device may use applications as units, and when all files of a certain application occupy a storage space that reaches a set value (e.g., 300MB), all files of the application are determined as files to be scanned.
[0038] In some other embodiments, the user may specify which files are to be scanned. For example, the user may specify a folder or an application, and the electronic device determines all files in the folder specified by the user as files to be scanned, or determines all files in the application specified by the user as files to be scanned. In this case, the user may not specify the folder or application in which the file is to be retained, and the electronic device will not scan the files in the unspecified folder or application.
[0039] 120 , in response to the file cleaning request, determining the importance level of each file according to the file information of each file.
[0040] In actual applications, when a user wants to clean up files on an electronic device, the user can start a file cleaning function, for example, a file cleaning function (or garbage cleaning function) can be started from a file cleaning tool (sdk). When the user starts the file cleaning function, the electronic device generates a file cleaning request and responds to the file cleaning request.
[0041] Specifically, when responding to a file cleanup request, the electronic device determines the importance level of the file based on the file information of each file. Among them, multiple importance levels can be pre-set in the electronic device, and the importance of files of different importance levels is different. For example, system files are of the highest importance, followed by program files, downloaded files, media files, and document files, and log files and cache files are of the lowest importance. It should be noted that the above example is only an example of file importance levels, and in actual applications, file importance levels can also be divided in other forms.
[0042] 130 , processing the files according to the simulation cleaning strategy corresponding to the importance level of each file to obtain a simulation cleaning result of the file.
[0043] Different simulation cleaning strategies can be pre-set in the electronic device for files of different importance levels, and the simulation cleaning strategies can be set or adjusted by the user. Among them, the simulation cleaning strategy is used to process the file to determine whether the file can be cleaned, and the simulation cleaning strategies corresponding to files of different importance levels are different. It can be understood that the importance level of the file is different, and the corresponding simulation cleaning strategy is also different, and the processing required is also different, so the time required to process files of different importance levels is also different.
[0044] After the electronic device determines the importance level of the file, it can process the file according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file. The simulation cleaning result includes cleanable and uncleanable. Among them, if the simulation cleaning result of the file is cleanable, it means that the file will not affect the user's use of the electronic device after cleaning, and can be cleaned; if the simulation cleaning result of the file is uncleanable, it means that the file will affect the user's use of the electronic device after cleaning, and therefore cannot be cleaned.
[0045] 140 , outputting cleanable files among the plurality of files according to the simulated cleaning result of each file.
[0046] After the electronic device obtains the simulated cleaning result of each file, it can output the cleanable files among the multiple files according to the simulated cleaning result of each file. Among them, the electronic device can output all the files that are cleanable according to the simulated cleaning result as a set as cleanable files. When the user confirms the cleaning, the electronic device can delete these cleanable files, thereby releasing the storage space occupied by these files.
[0047] The file cleaning method of the embodiment of the present application can determine the importance level of each file, and process the file according to the simulation cleaning strategy corresponding to the importance level of the file. The simulation cleaning strategies corresponding to files of different importance levels are different, and thus the time required to process files of different importance levels is also different. Therefore, the file processing method is more flexible, and different files can be processed differently. There is no need to perform the same processing on a large number of files, thereby reducing the time spent on cleaning a large number of files and improving file cleaning efficiency.
[0048] In some embodiments, reference Figure 3 , Figure 3 This is a first schematic diagram of processing a file in an embodiment of the present application.
[0049] The preset importance levels include a first level and a second level, and the importance of the second level is higher than the importance of the first level. For example, the importance level of system files and program files can be the second level, and the importance level of other files is the first level.
[0050] Wherein, step 130: processing the files according to the simulated cleaning strategy corresponding to the importance level of each file to obtain the simulated cleaning result of the file includes the following steps:
[0051] 131, if the importance level of the file is the first level, marking the simulated cleaning result of the file as cleanable;
[0052] 132. If the importance level of the file is the second level, simulate cleaning the file and run at least one function associated with the file; if the function runs normally, mark the simulated cleaning result of the file as cleanable; if the function runs abnormally, mark the simulated cleaning result of the file as uncleanable.
[0053] When the electronic device processes the file according to the simulated cleaning strategy, if the importance level of the file is the first level, that is, the importance level of the file is low, such as log files, cache files, etc., the simulated cleaning result of the file is directly marked as cleanable without further processing. Therefore, for files with the first level of importance, the processing process can be minimized, processing time can be saved, and efficiency can be improved.
[0054] If the importance level of the file is the second level, such as a program file, the file is first simulated cleaned. Simulated cleaning can be understood as simulating deletion of the file, but it does not actually delete the file, but disables the file, such as prohibiting any process of the electronic device from accessing or calling the file.
[0055] Subsequently, the electronic device runs at least one function associated with the file, and determines whether the file can be cleaned according to the running result. It is understandable that since the file is simulated and deleted, the file does not play a role in running the function associated with the file. Therefore, if the function runs normally, it means that deleting the file will not affect the normal function of the electronic device, and the simulated cleaning result of the file is marked as cleanable. If the function runs abnormally, it means that deleting the file will affect the normal function of the electronic device, and the simulated cleaning result of the file is marked as uncleanable.
[0056] Therefore, by performing the above-mentioned different processing on files of the first and second importance levels, the security of file cleaning can be guaranteed, and at the same time, the time consumed in file cleaning can be reduced, thereby improving the efficiency of file cleaning.
[0057] In some embodiments, reference Figure 4 , Figure 4 This is a second schematic diagram of processing a file in an embodiment of the present application.
[0058] The preset importance levels include a third level in addition to the first level and the second level, and the third level is more important than the second level. For example, the importance level of system files and program files can be the third level, the importance level of download files, media files, and document files can be the second level, and the importance level of other files is the first level.
[0059] Wherein, step 130: processing the files according to the simulated cleaning strategy corresponding to the importance level of each file to obtain the simulated cleaning result of the file, further includes the following steps:
[0060] 133. If the importance level of the file is the third level, the file is simulated cleaned and all functions associated with the file are run; if all functions run normally, the simulated cleanup result of the file is marked as cleanable; if there is an abnormal function among all functions, the simulated cleanup result of the file is marked as uncleanable.
[0061] When the electronic device processes the file according to the simulation cleaning strategy, if the importance level of the file is the third level, such as a program file, the file is first simulated cleaned. Subsequently, the electronic device runs all functions associated with the file and determines whether the file can be cleaned according to the running results.
[0062] If all functions run normally, it means that deleting the file will not affect the normal functions of the electronic device, and the simulated cleaning result of the file is marked as cleanable. If there is an abnormal function among all functions, it means that deleting the file will affect the normal functions of the electronic device, and the simulated cleaning result of the file is marked as uncleanable.
[0063] In the embodiment of the present application, files with the second and third importance levels are processed differently, that is, for files with the second importance level, at least one function associated with the file is run after simulated cleaning; and for files with the third importance level, all functions associated with the file are run after simulated cleaning. It can be understood that compared with files with the second importance level, files with the third importance level are more important and play a greater role in the normal operation of electronic devices. Therefore, for such files, it is necessary to fully verify whether the simulated cleaning affects the normal functions of the electronic devices. Therefore, the security of file cleaning can be further improved.
[0064] In some embodiments, continue to refer to Figure 4 , wherein the pre-set importance level also includes a fourth level, and the fourth level of importance is higher than the third level of importance. For example, the importance level of system files can be the fourth level, the importance level of program files can be the third level, the importance level of download files, media files, and document files can be the second level, and the importance level of other files can be the first level.
[0065] Wherein, step 130: processing the files according to the simulated cleaning strategy corresponding to the importance level of each file to obtain the simulated cleaning result of the file, further includes the following steps:
[0066] 134. If the importance level of the file is the fourth level, the simulated cleaning result of the file is marked as uncleanable.
[0067] When the electronic device processes the file according to the simulated cleaning strategy, if the importance level of the file is the fourth level, that is, the importance level of the file is very high, such as system files, such files are usually associated with many functions, and it will take a long time to verify the associated functions one by one. Therefore, given the high importance level of such files, the simulated cleaning result of the file can be directly marked as uncleanable without further processing.
[0068] Therefore, for files with the fourth level of importance, the processing process can also be minimized, saving processing time and improving efficiency.
[0069] In some embodiments, reference Figure 5 , Figure 5 This is a second flow chart of the file cleaning method according to an embodiment of the present application.
[0070] Wherein, before step 120: in response to the file cleaning request, determining the importance level of each file according to the file information of each file, the file cleaning method further comprises the following steps:
[0071] 150, adding the file information of the multiple files to the cache in batches.
[0072] After the electronic device scans multiple files to be scanned and obtains the file information of each file, the file information of the multiple files can be added to the cache in batches. It can be understood that the electronic device can quickly read the file information loaded in the cache at any time. In addition, adding to the cache in batches can not only cache the file information in time to avoid wasting time after the scanning process is interrupted, but also avoid frequently calling system resources to write to the cache, thereby saving system resources.
[0073] In actual applications, file information can be added to the cache in batches in a variety of ways.
[0074] In an application example, the file information may be cached in batches according to the data size. Specifically, a preset data size may be set, and the preset data size is a data size, such as 3MB, 5MB, 10MB, etc. When scanning multiple files, when the data size of the scanned file information reaches the preset data size, the scanned file information is added to the cache as a batch.
[0075] refer to Figure 6 , Figure 6 This is a first schematic diagram of adding file information to the cache in batches in the embodiment of the present application. For example, after scanning file a, file b, and file c, the data volume of the file information obtained reaches the preset data volume, and the scanned file information is added to the cache as a batch; after scanning file d, file e, and file f, the data volume of the file information obtained reaches the preset data volume, and the scanned file information is added to the cache as a batch; and this process continues until the scanning of the multiple files is completed.
[0076] In addition, it is understandable that if the number of files to be scanned is small, or after multiple batches of file information have been cached, the number of remaining files is small, then the data volume of the scanned file information may not reach the preset data volume, and the file information also needs to be cached. Therefore, when the multiple files have been scanned and the data volume of the scanned file information has not reached the preset data volume, the scanned file information can also be added to the cache as a batch. Thus, no matter how many files are there to be scanned, the scanning of all files can be completed and the file information can be cached.
[0077] In another application example, batch caching can be performed according to the scanning duration. Specifically, a preset duration can be set, such as 3 seconds, 5 seconds, 10 seconds, etc. When scanning multiple files, when the scanning duration reaches the preset duration, the scanned file information is added to the cache as a batch.
[0078] refer to Figure 7 , Figure 7 This is a second schematic diagram of adding file information to the cache in batches in the embodiment of the present application. For example, after scanning file a, file b, and file c, the scanning time reaches the preset time, and the scanned file information is added to the cache as a batch; after scanning file d, file e, and file f, the scanning time reaches the preset time, and the scanned file information is added to the cache as a batch; and this process continues until the scanning of the multiple files is completed.
[0079] In addition, it is understandable that if the number of files to be scanned is small, or after multiple batches of file information have been cached, the number of remaining files is small, then the scanning time to scan the remaining files may not reach the preset time, and the file information also needs to be cached. Therefore, when the multiple files have been scanned and the scanning time has not reached the preset time, the scanned file information can also be added to the cache as a batch. Therefore, no matter how many files are there to be scanned, the scanning of all files can be completed and the file information can be cached.
[0080] In another application example, the files can be cached in batches according to the number of files scanned. Specifically, a preset number can be set, such as 3, 5, 10, etc. When scanning multiple files, when scanning of the preset number of files in the multiple files is completed, the scanned file information is added to the cache as a batch.
[0081] refer to Figure 8 , Figure 8This is a third schematic diagram of adding file information to the cache in batches in the embodiment of the present application. For example, the preset number is 3, then after scanning the three files of file a, file b, and file c, the scanned file information is added to the cache as a batch; after scanning the three files of file d, file e, and file f, the scanned file information is added to the cache as a batch; and this process continues until the scanning of the multiple files is completed.
[0082] In addition, it is understandable that if the number of files to be scanned is small, or after multiple batches of file information have been cached, the number of remaining files is small, then the number of remaining files may not reach the preset number, and the file information also needs to be cached. Therefore, when the multiple files have been scanned and the number of files corresponding to the scanned file information has not reached the preset number, the scanned file information is added to the cache as a batch. Therefore, no matter how many files are to be scanned, the scanning of all files can be completed and the file information can be cached.
[0083] In specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.
[0084] As can be seen from the above, the file cleaning method provided by the embodiment of the present application includes: scanning multiple files to be scanned to obtain file information of each file; in response to a file cleaning request, determining the importance level of the file according to the file information of each file; processing the file according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file; outputting the cleanable file in multiple files according to the simulation cleaning result of each file. The file cleaning method of the embodiment of the present application can determine the importance level of each file, and process the file according to the simulation cleaning strategy corresponding to the importance level of the file. The simulation cleaning strategies corresponding to files of different importance levels are different, so the time required to process files of different importance levels is also different. Therefore, the file processing method is more flexible, and different files can be processed differently, without the need to process a large number of files in the same way, thereby reducing the time spent on cleaning a large number of files and improving the efficiency of file cleaning.
[0085] The present application also provides a file cleaning device, which can be integrated in an electronic device. The electronic device can be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a data storage device, a video playback device, a laptop computer, a desktop computing device, etc.
[0086] refer to Fig. 9, Fig. 9 1 is a schematic diagram of a first structure of a file cleaning device 200 according to an embodiment of the present application, wherein the file cleaning device 200 comprises: a scanning module 210 , a determining module 220 , a processing module 230 , and an output module 240 .
[0087] The scanning module 210 is used to scan multiple files to be scanned and obtain file information of each file;
[0088] A determination module 220, for determining the importance level of each file according to the file information of each file in response to the file cleaning request;
[0089] A processing module 230 is used to process the files according to the simulation cleaning strategy corresponding to the importance level of each file to obtain a simulation cleaning result of the file;
[0090] The output module 240 is used to output the cleanable files among the multiple files according to the simulated cleaning result of each file.
[0091] In some embodiments, the importance level includes a first level and a second level, and the importance of the second level is higher than the importance of the first level. The processing module 230 is used to:
[0092] If the importance level of the file is the first level, the simulated cleaning result of the file is marked as cleanable;
[0093] If the importance level of the file is the second level, the file is simulated cleaned and at least one function associated with the file is run; if the function runs normally, the simulated cleanup result of the file is marked as cleanable; if the function runs abnormally, the simulated cleanup result of the file is marked as uncleanable.
[0094] In some embodiments, the importance level further includes a third level, and the importance of the third level is higher than the importance of the second level. The processing module 230 is also used to:
[0095] If the importance level of the file is the third level, the file is simulated cleaned and all functions associated with the file are run;
[0096] If all functions run normally, the simulated cleaning result of the file is marked as cleanable; if there is a function that runs abnormally among all functions, the simulated cleaning result of the file is marked as uncleanable.
[0097] In some embodiments, the importance level further includes a fourth level, and the importance of the fourth level is higher than the importance of the third level. The processing module 230 is also used to:
[0098] If the importance level of the file is the fourth level, the simulated cleaning result of the file is marked as uncleanable.
[0099] In some embodiments, reference Fig.10 , Fig.10 2 is a schematic diagram of a second structure of the file cleaning device 200 of the embodiment of the present application. The file cleaning device 200 further includes a cache module 250. The cache module 250 is used to:
[0100] Add file information of multiple files to the cache in batches.
[0101] It can be understood that the specific implementation of each of the above modules can refer to the description of each embodiment of the above file cleaning method, which will not be repeated here.
[0102] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same entity or several entities.
[0103] As can be seen from the above, the file cleaning device 200 provided in the embodiment of the present application scans multiple files to be scanned through the scanning module 210 to obtain the file information of each file; the determination module 220 responds to the file cleaning request and determines the importance level of the file according to the file information of each file; the processing module 230 processes the file according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file; the output module 240 outputs the cleanable file in the multiple files according to the simulation cleaning result of each file. The file cleaning device 200 in the embodiment of the present application can determine the importance level of each file, and process the file according to the simulation cleaning strategy corresponding to the importance level of the file. The simulation cleaning strategy corresponding to the files of different importance levels is different, so the time required to process the files of different importance levels is also different. Therefore, the file processing method is more flexible, and different files can be processed differently, without the need to process a large number of files in the same way, thereby reducing the time spent on cleaning a large number of files and improving the file cleaning efficiency.
[0104] The embodiment of the present application also provides an electronic device. The electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a data storage device, a video playback device, a laptop computer, a desktop computing device, etc.
[0105] refer to Fig.11 , Fig.11 Schematic diagram of the structure of an electronic device 300 according to an embodiment of the present application.
[0106] The electronic device 300 includes a processor 310 and a memory 320. The processor 310 is electrically connected to the memory 320.
[0107] The processor 310 is the control center of the electronic device 300. It uses various interfaces and lines to connect various parts of the entire electronic device, executes various functions of the electronic device and processes data by running or calling computer programs stored in the memory 320, and calling data stored in the memory 320, thereby monitoring the electronic device as a whole.
[0108] The memory 320 can be used to store computer programs and data. The computer programs stored in the memory 320 contain instructions that can be executed in the processor. The computer programs can form various functional modules. The processor 310 executes various functional applications and data processing by calling the computer programs stored in the memory 320. In addition, the memory 320 can also be used to store various files of the electronic device 300.
[0109] In this embodiment, the processor 310 in the electronic device 300 loads instructions corresponding to the processes of one or more computer programs into the memory 320 according to the following steps, and the processor 310 runs the computer program stored in the memory 320, thereby performing the following steps:
[0110] Scan multiple files to be scanned to obtain file information of each file;
[0111] In response to the file cleaning request, determining the importance level of each file according to the file information of each file;
[0112] The files are processed according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file;
[0113] Output the cleanable files in multiple files according to the simulated cleaning results of each file.
[0114] In some embodiments, the importance level includes a first level and a second level, and the importance of the second level is higher than the importance of the first level. When the file is processed according to the simulation cleaning strategy corresponding to the importance level of each file and the simulation cleaning result of the file is obtained, the processor 310 performs the following steps:
[0115] If the importance level of the file is the first level, the simulated cleaning result of the file is marked as cleanable;
[0116] If the importance level of the file is the second level, the file is simulated cleaned and at least one function associated with the file is run; if the function runs normally, the simulated cleanup result of the file is marked as cleanable; if the function runs abnormally, the simulated cleanup result of the file is marked as uncleanable.
[0117] In some embodiments, the importance level further includes a third level, and the importance of the third level is higher than the importance of the second level. When the file is processed according to the simulation cleaning strategy corresponding to the importance level of each file and the simulation cleaning result of the file is obtained, the processor 310 further performs the following steps:
[0118] If the importance level of the file is the third level, the file is simulated cleaned and all functions associated with the file are run;
[0119] If all functions run normally, the simulated cleaning result of the file is marked as cleanable; if there is a function that runs abnormally among all functions, the simulated cleaning result of the file is marked as uncleanable.
[0120] In some embodiments, the importance level further includes a fourth level, and the fourth level is more important than the third level. When the file is processed according to the simulation cleaning strategy corresponding to the importance level of each file and the simulation cleaning result of the file is obtained, the processor 310 further performs the following steps:
[0121] If the importance level of the file is the fourth level, the simulated cleaning result of the file is marked as uncleanable.
[0122] In some embodiments, in response to the file cleaning request, before determining the importance level of each file according to the file information of each file, the processor 310 further performs the following steps:
[0123] Add file information of multiple files to the cache in batches.
[0124] although Fig.11 Not shown, the electronic device 300 may also include a display screen, a control circuit, an input / output unit, a camera module, etc., which will not be described in detail here.
[0125] As can be seen from the above, an embodiment of the present application provides an electronic device, which performs the following steps: scanning multiple files to be scanned to obtain file information of each file; determining the importance level of the file according to the file information of each file in response to a file cleaning request; processing the file according to the simulation cleaning strategy corresponding to the importance level of each file to obtain a simulation cleaning result of the file; and outputting a cleanable file from multiple files according to the simulation cleaning result of each file. The electronic device of the embodiment of the present application can determine the importance level of each file, and process the file according to the simulation cleaning strategy corresponding to the importance level of the file. Files of different importance levels have different corresponding simulation cleaning strategies, so the time required to process files of different importance levels is also different. Therefore, the file processing method is more flexible, and different files can be processed differently, without the need to process a large number of files in the same way, thereby reducing the time spent on cleaning a large number of files and improving file cleaning efficiency.
[0126] An embodiment of the present application further provides a storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the file cleaning method of any of the above embodiments.
[0127] It should be noted that a person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the storage medium may include but is not limited to: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0128] The above is a detailed introduction to the file cleaning method, device, storage medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application; at the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A file cleaning method, characterized in that: include: Scanning multiple files to be scanned to obtain file information of each file, wherein the file information is used to indicate the type of the file; In response to a file cleaning request, determining an importance level of each file according to the file information of each file; Processing the files according to the simulated cleaning strategy corresponding to the importance level of each file to obtain simulated cleaning results of the files, wherein files of different importance levels correspond to different simulated cleaning strategies; Output the cleanable files among the multiple files according to the simulated cleaning result of each of the files.
2. The file cleaning method according to claim 1, characterized in that: The importance level includes a first level and a second level, the importance of the second level is higher than the importance of the first level, and the files are processed according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file, including: If the importance level of the file is the first level, marking the simulated cleaning result of the file as cleanable; If the importance level of the file is the second level, the file is simulated cleaned and at least one function associated with the file is run; if the function runs normally, the simulated cleanup result of the file is marked as cleanable; if the function runs abnormally, the simulated cleanup result of the file is marked as uncleanable.
3. The file cleaning method according to claim 2, characterized in that: The importance level further includes a third level, the importance of the third level is higher than the importance of the second level, and the processing of the files according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file also includes: If the importance level of the file is the third level, performing simulation cleaning on the file and running all functions associated with the file; If all the functions run normally, the simulated cleaning result of the file is marked as cleanable; if there is a function that runs abnormally among all the functions, the simulated cleaning result of the file is marked as uncleanable.
4. The file cleaning method according to claim 3, characterized in that: The importance level also includes a fourth level, the importance of the fourth level is higher than the importance of the third level, and the processing of the files according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file also includes: If the importance level of the file is the fourth level, the simulated cleaning result of the file is marked as uncleanable.
5. The file cleaning method according to any one of claims 1 to 4, characterized in that: Before determining the importance level of each file according to the file information of each file in response to the file cleaning request, the method further includes: The file information of the multiple files is added to the cache in batches.
6. The file cleaning method according to claim 5, characterized in that: The step of adding the file information of the plurality of files to the cache in batches includes: When the data volume of the file information obtained by scanning the plurality of files reaches a preset data volume, the scanned file information is added to the cache as a batch; or When the plurality of files have been scanned and the data volume of the scanned file information does not reach the preset data volume, the scanned file information is added to the cache as a batch.
7. The file cleaning method according to claim 5, characterized in that: The step of adding the file information of the plurality of files to the cache in batches includes: When the scanning time for scanning the plurality of files reaches a preset time, the scanned file information is added to the cache as a batch; or When the scanning of the plurality of files is completed and the scanning time does not reach the preset time, the scanned file information is added to the cache as a batch.
8. The file cleaning method according to claim 5, characterized in that: The step of adding the file information of the plurality of files to the cache in batches includes: When scanning of a preset number of files among the plurality of files is completed, adding the scanned file information as a batch to the cache; or When the plurality of files have been scanned and the number of files corresponding to the scanned file information does not reach the preset number, the scanned file information is added to the cache as a batch.
9. A file cleaning device, characterized in that: include: A scanning module, used for scanning a plurality of files to be scanned, and obtaining file information of each of the files, wherein the file information is used for indicating the type of the file; A determination module, configured to determine the importance level of each file according to the file information of each file in response to a file cleaning request; A processing module, used for processing the files according to the simulation cleaning strategy corresponding to the importance level of each file to obtain the simulation cleaning result of the file, wherein files of different importance levels correspond to different simulation cleaning strategies; The output module is used to output the cleanable files among the multiple files according to the simulated cleaning results of each of the files.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is run on a computer, the computer is enabled to execute the file cleaning method according to any one of claims 1 to 8.
11. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein a computer program is stored in the memory, and the processor is used to execute the file cleaning method according to any one of claims 1 to 8 by running the computer program stored in the memory.