File deleting method, server, computer equipment, medium and program product
By executing the file deletion process on the server at preset time intervals, reading the file information of the files to be deleted in the file database built by the file synchronization process in turn, comparing the file modification time with the latest modification time, and performing the deletion process in the same situation, solving the problem of the file deletion method in the existing technology that the file deletion method is accidentally deleted and updated, and achieving efficient and safe file deletion.
Patent Information
- Application Number
- CN202411741281.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-07
AI Technical Summary
In the prior art, the file deletion method will delete all synchronized files after receiving the message of the file synchronization cost, and does not consider the case of file update again, resulting in the error deletion of files that have not been synchronized, and the risk of mistaken deletion is high.
By executing the file deletion process on the server at preset time intervals, reading the file information of the files to be deleted in the file database built by the file synchronization process in turn, comparing the file modification time and the latest modification time, and deleting it in the same situation, ensuring that only unupdated files are deleted.
It effectively prevents unsynchronized files after being deleted by mistake, improves the success rate of file deletion, reduces the risk of error deletion, and ensures that the file is finally successfully deleted by executing the file deletion process multiple times.
Smart Images

Figure CN119576872A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of file transmission, and in particular to a method for deleting files, a server, a computer device, a medium and a program product. Background Art
[0002] In the field of file transfer technology, due to actual business requirements, it is necessary to automatically synchronize files in the source server to the destination server. However, after the files are synchronized from the source server to the destination server, if the files that have been synchronized in the source server are not processed, the files on the source server will accumulate, and the server disk space will be exhausted. In this regard, it is necessary to use an automatic file deletion method to delete the synchronized files. However, the file deletion method used in the prior art will delete all synchronized files after receiving a message about the file synchronization cost, without considering the case where the file is updated again, thereby mistakenly deleting the updated but not synchronized files. Therefore, the file deletion method used in the prior art has the problem of a high risk of mistakenly deleting files. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method for deleting files, a server, a computer device, a machine-readable storage medium and a computer program product, so as to solve the problem that the file deletion method adopted in the prior art has a high risk of deleting files by mistake.
[0004] In order to achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a method for deleting a file, which is applied to a server, and the method includes:
[0005] Execute the file deletion process at a preset time interval, and read the file information of the files to be deleted in the file database constructed by the file synchronization process in sequence. The file database records the file information of multiple files to be deleted, and the file information includes the file name, storage path and file modification time. The file modification time is the time when the file was last modified before synchronization;
[0006] According to the file name and storage path of the file to be deleted, query the latest modification time of the file to be deleted;
[0007] Compare the file modification time of the file to be deleted with the latest modification time;
[0008] When the file modification time and the latest modification time are consistent, the file to be deleted is deleted.
[0009] In an embodiment of the present application, the method further includes: when the file modification time and the latest modification time are inconsistent, skipping and retaining the file to be deleted, and reading the next file to be deleted in the file database.
[0010] In an embodiment of the present application, the file information also includes the file synchronization time. When the file modification time and the latest modification time are consistent, the file to be deleted is deleted, including: determining the target time according to the file modification time and the preset time interval; comparing the file synchronization time and the target time; when the file synchronization time is later than the target time, writing the file information of the file to be deleted into a target prompt file, the target prompt file is used to store the file information of files that have not been successfully deleted for multiple times; and deleting the file to be deleted.
[0011] In an embodiment of the present application, the method further includes: after all the files to be deleted in the file database are read, outputting a target prompt file.
[0012] In an embodiment of the present application, the file synchronization process is executed at a preset time interval, and the file database is updated at a preset time interval.
[0013] In an embodiment of the present application, executing the file deletion process at a preset time interval includes: after the file synchronization process completes the file synchronization operation and records the file information of the synchronized file in the file database, executing the file deletion process.
[0014] A second aspect of an embodiment of the present application provides a server configured to execute the above-mentioned method for deleting files.
[0015] A third aspect of an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned method of deleting files when executing the computer program.
[0016] A fourth aspect of an embodiment of the present application provides a machine-readable storage medium, on which a program or instruction is stored, and the program or instruction implements the above-mentioned method of deleting files when executed by a processor.
[0017] A fifth aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned method of deleting files when executed by a processor.
[0018] The above technical solution, by executing the file deletion process at a preset time interval, sequentially reads the file information of the files to be deleted in the file database constructed by the file synchronization process, the file database records the file information of multiple files to be deleted, the file information includes the file name, storage path and file modification time, the file modification time is the time when the file was last modified before synchronization, and then inquires about the latest modification time of the file to be deleted according to the file name and storage path of the file to be deleted, then compares the file modification time of the file to be deleted and the latest modification time, and finally deletes the file to be deleted when the file modification time and the latest modification time are consistent. The present application can execute the file deletion process multiple times at a preset time interval and perform multiple deletion operations to prevent the file from being successfully deleted, and at the same time judge the file update status to prevent the accidental deletion of files that are not synchronized after the update, which is conducive to improving the success rate of file deletion and reducing the risk of accidental deletion.
[0019] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0021] Figure 1 A flowchart of a method for deleting a file provided in an embodiment of the present application;
[0022] Figure 2 A flowchart of a file synchronization process provided in a specific embodiment of the present application;
[0023] Figure 3 A flowchart of a file deletion process provided in a specific embodiment of the present application;
[0024] Figure 4 A device for deleting files is provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0026] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0027] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0028] In the embodiments of the present application, the server mainly refers to the source server. The source server can be deployed with a file synchronization process and a file deletion process. After receiving a new file or updating an existing file, the source server will synchronize the above files to the destination server to ensure data consistency. It can be understood that in order to prevent the accumulation of files on the source server, the source server needs to delete the synchronized files after the file synchronization is completed. In order to ensure that the file is deleted successfully and prevent the accidental deletion of files, the embodiments of the present application provide a method for deleting files.
[0029] Figure 1 A flowchart of a method for deleting files provided in an embodiment of the present application is shown below. Figure 1 As shown, an embodiment of the present application provides a method for deleting files, which is applied to a server and may include the following steps.
[0030] Step S101, execute the file deletion process at a preset time interval, and read the file information of the files to be deleted in the file database constructed by the file synchronization process in sequence. The file database records the file information of multiple files to be deleted, and the file information includes the file name, storage path and file modification time. The file modification time is the time when the file was last modified before synchronization.
[0031] Step S102, querying the latest modification time of the file to be deleted according to the file name and storage path of the file to be deleted.
[0032] Step S103, comparing the file modification time and the latest modification time of the file to be deleted.
[0033] Step S104: When the file modification time and the latest modification time are consistent, the file to be deleted is deleted.
[0034] Specifically, the preset time interval refers to the preset file synchronization time interval, which can be set according to actual needs or experience. In order to improve the success rate of file deletion, the file deletion process in the embodiment of the present application will be executed periodically according to the preset time interval, and maintain the same frequency as the file synchronization process, that is, the file synchronization process and the file deletion process are executed successively within a preset time interval. It can be understood that after the file synchronization is completed, the file synchronization process in the embodiment of the present application will record the file information of the synchronized file, that is, the file information of the file to be deleted, in the file database, and send it to the file deletion process to provide data support for the file deletion operation of the file deletion process. When executing the file deletion process, the file information of the file to be deleted in the file database can be read in sequence to perform file deletion processing one by one. Among them, the file information includes the file name, storage path and file modification time. The file name and the file storage path can be used as the unique identifier of the file to locate the file. The file modification time refers to the time when the file was last modified before synchronization, mainly referring to the last modification time before this round of file synchronization of the file synchronization process corresponding to the current file deletion process.
[0035] Furthermore, the current information to be deleted can be located according to the file name and storage path of the file to be deleted, and the latest modification time of the file to be deleted in the source server can be queried. In order to determine whether the file to be deleted has been modified again after synchronization, the file modification time of the file to be deleted and the latest modification time can be compared to determine whether the two are consistent. If the file modification time of the file to be deleted is consistent with the latest modification time, it means that the file to be deleted has not been modified a second time after synchronization. At this time, the file to be deleted can be directly deleted. After the deletion is completed, continue to query the next file to be deleted in the file database until the files recorded in the file database are processed.
[0036] The above technical solution, by executing the file deletion process at a preset time interval, sequentially reads the file information of the files to be deleted in the file database constructed by the file synchronization process, the file database records the file information of multiple files to be deleted, the file information includes the file name, storage path and file modification time, the file modification time is the time when the file was last modified before synchronization, and then inquires about the latest modification time of the file to be deleted according to the file name and storage path of the file to be deleted, then compares the file modification time of the file to be deleted and the latest modification time, and finally deletes the file to be deleted when the file modification time and the latest modification time are consistent. The present application can execute the file deletion process multiple times at a preset time interval and perform multiple deletion operations to prevent the file from being successfully deleted, and at the same time judge the file update status to prevent the accidental deletion of files that are not synchronized after the update, which is conducive to improving the success rate of file deletion and reducing the risk of accidental deletion.
[0037] In an embodiment of the present application, the method further includes: when the file modification time and the latest modification time are inconsistent, skipping and retaining the file to be deleted, and reading the next file to be deleted in the file database.
[0038] Specifically, if the modification time of the file to be deleted is inconsistent with the latest modification time, it means that the file has been modified again after synchronization. At this time, the file needs to be resynchronized to the destination server. Therefore, the file is not deleted, and the file is retained in the source server for synchronization in the next round of file synchronization. The file is skipped and the next file to be deleted in the file database is read, and the next file to be deleted is processed using the same processing logic. In this way, it can prevent accidental deletion of files and reduce the risk of accidental deletion of files.
[0039] In an embodiment of the present application, executing the file deletion process at a preset time interval includes: after the file synchronization process completes the file synchronization operation and records the file information of the synchronized file in the file database, executing the file deletion process.
[0040] It can be understood that the file deletion process is executed after the file synchronization process completes the file synchronization operation. After the file synchronization process ends, the file information of the synchronized files will be recorded in the file database and sent to the file deletion process as information to be deleted, so that the file deletion process can perform targeted file deletion processing to prevent accidental deletion of files.
[0041] In an embodiment of the present application, the file information also includes the file synchronization time. When the file modification time and the latest modification time are consistent, the file to be deleted is deleted, including: determining the target time according to the file modification time and the preset time interval; comparing the file synchronization time and the target time; when the file synchronization time is later than the target time, writing the file information of the file to be deleted into a target prompt file, the target prompt file is used to store the file information of files that have not been successfully deleted for multiple times; and deleting the file to be deleted.
[0042] It is understandable that there may be a situation in the source server where a certain file has been deleted multiple times but has not been successfully deleted. In this case, the customer needs to be notified and the customer needs to delete it manually if necessary. In this regard, the embodiment of the present application can judge the historical deletion of the file to be deleted through the file information of the file to be deleted. Specifically, the file information of the file to be deleted recorded in the file database also includes the file synchronization time, which refers to the time when the file to be deleted was most recently synchronized, usually the start time of the corresponding file synchronization process.
[0043] It can be understood that, under normal circumstances, after receiving a new file or detecting that a file has been modified, the source server will immediately synchronize the file to the destination server to ensure data consistency and prevent delayed updates from affecting subsequent processing. Therefore, when a file is deleted normally, its file modification time is usually earlier than the file synchronization time. Taking into account the delayed synchronization, a comprehensive judgment can be made in combination with the preset time interval, that is, the file synchronization time interval. That is, the target time is determined according to the file modification time and the preset time interval, and then the target time is compared with the file synchronization time. In one example, the target time can be the sum of the file modification time and the preset time interval. In another example, the target time can be the sum of the product of the preset time interval and the preset coefficient and the file modification time. The preset coefficient can be set according to the specific situation, for example, target time = file modification time + preset time interval * 3. In this way, the influence of delayed synchronization on the judgment result can be avoided, and the accuracy of the judgment result can be provided.
[0044] Furthermore, if the file synchronization time is later than the target time, it means that the file has been synchronized multiple times without being modified, that is, it has not been successfully deleted multiple times. At this time, the file information of the file to be deleted can be written into the target prompt file, and the file to be deleted can be deleted again. Among them, the target prompt file can be used to store the file information of files that have not been successfully deleted multiple times, and the target prompt file is stored in a specific directory on the source server that has not been deleted by the file and monitored by the file synchronization process. In this way, the files that have not been successfully deleted multiple times can be recorded so that the client can be prompted to handle them later.
[0045] In an embodiment of the present application, the method further includes: after all the files to be deleted in the file database are read, outputting a target prompt file.
[0046] It can be understood that after all the files to be deleted in the file database have been processed, the target prompt file can be output to the front-end display device in combination with the prompt information to promptly remind the customer that there are multiple files that have not been successfully deleted, so that the customer can process the batch of files in time to prevent the disk space of the source server from being occupied for a long time.
[0047] In an embodiment of the present application, the file synchronization process is executed at a preset time interval, and the file database is updated at a preset time interval.
[0048] It can be understood that the preset time interval is the file synchronization time interval. The file synchronization process of the source program in the embodiment of the present application is executed periodically according to the preset time interval. At the same time, the records in the file database are updated periodically according to the preset time interval. In other words, each time the file synchronization process is executed, the records in the file database are updated once, and only the file information of each file synchronized by the file synchronization process is recorded. In this way, if there are multiple undeleted files, the file will be synchronized again or even multiple times, then the file modification time of the file remains unchanged, but the file synchronization time has been pushed back, resulting in the file synchronization time being much later than the file modification time, and then it can be judged that the file is a file that has not been successfully deleted multiple times, so as to prompt the customer.
[0049] In a specific embodiment of the present application, a method for deleting synchronized files on a source server is provided, including a file synchronization process and a file deletion process. The synchronized file information is recorded in a file database in the file synchronization process, and the file database is sent to a process responsible for deleting files on the source side. The file deletion process completes the file deletion according to a preset judgment logic. Specifically, Figure 2 A flowchart of a file synchronization process provided by a specific embodiment of the present application. Figure 2 As shown, the file synchronization process includes the following steps:
[0050] S21. Start.
[0051] S22. Issue a file synchronization policy and an attached source deletion policy, and establish a communication mechanism.
[0052] S23, determine whether there is an existing file in the server. If so, go to S24; if not, go to S25.
[0053] S24. Move the existing files to a specific directory.
[0054] S25. Notify the source-side deletion process to stop the deletion operation and enable the file synchronization function.
[0055] S26. File synchronization is completed and file information is recorded in the database.
[0056] S27, notifying the source end deletion process to start deleting the source end files.
[0057] S28: Determine whether the current synchronization time interval has expired. If so, proceed to S25 to start the next round of synchronization.
[0058] Among them, the specific directory is a directory used to store the original files before the first file synchronization. This directory is not monitored by the file synchronization process and is only used as a directory to save the files of the source server and subsequent prompt information. It can be understood that the process of determining whether there are existing files in the server and performing corresponding processing is only performed before the first file synchronization starts, and this process is not executed during subsequent file synchronization processes.
[0059] Figure 3 A flowchart of a file deletion process provided by a specific embodiment of the present application. Figure 3 As shown, the file deletion process includes the following steps:
[0060] S31. Start.
[0061] S32, monitoring the information sent by the file synchronization process, and determining whether it is necessary to enable source-side deletion; if yes, proceed to S34, otherwise proceed to S33.
[0062] S33, block and wait until it is turned on.
[0063] S34. Read the file modification time in the file information of the to-be-deleted files stored in the file database in sequence.
[0064] S35. Query the latest modification time of the file to be deleted in the source server.
[0065] S36: Check whether the file modification time is consistent with the latest modification time. If yes, proceed to S38; otherwise, proceed to S37.
[0066] S37. Continue to query the next file to be modified and enter S35.
[0067] S38. Calculate the target time according to the preset file synchronization time interval and the file modification time.
[0068] S39, judging whether the target time is later than the start time of the current round of synchronization of the file to be deleted. If yes, proceed to S311, otherwise proceed to S310.
[0069] S310, writing a prompt file to the file server.
[0070] S311. Delete files.
[0071] S312: Has a notification of stopping file deletion been received? If yes, proceed to S32; otherwise, proceed to S313.
[0072] S313, judging whether the files recorded in the database have been processed. If yes, then go to S33 and continue to block and wait; otherwise, go to S35 and continue to delete the next file.
[0073] In summary, this application can determine the update status of files after synchronization, so as to maximize the guarantee that files that do not need to be saved in the source server and files that have been modified but not synchronized will not be accidentally deleted. This application can execute the file deletion process multiple times, so as to ensure that if the file server fails to delete the file once, it can delete it multiple times to improve the success rate of file deletion. In addition, if a file is deleted multiple times without success, a prompt information file can be automatically generated on the server side to remind the server user to check the problem.
[0074] The embodiment of the present application also provides a server configured to execute the method for deleting files in the above implementation.
[0075] Figure 4 A device for deleting files provided in an embodiment of the present application. Figure 4 As shown, the embodiment of the present application also provides a device 400 for deleting files, which is applied to a server, and the device 400 includes:
[0076] The data acquisition model 410 is used to execute the file deletion process at a preset time interval, and sequentially read the file information of the files to be deleted in the file database constructed by the file synchronization process. The file database records the file information of multiple files to be deleted, and the file information includes the file name, storage path and file modification time. The file modification time is the time when the file was last modified before synchronization.
[0077] The data query module 420 is used to query the latest modification time of the file to be deleted according to the file name and storage path of the file to be deleted.
[0078] The data processing module 430 is used to compare the file modification time and the latest modification time of the file to be deleted.
[0079] The file deletion module 440 is used to delete the file to be deleted when the file modification time and the latest modification time are consistent.
[0080] The above-mentioned device 400 for deleting files executes the file deletion process at a preset time interval, and sequentially reads the file information of the files to be deleted in the file database constructed by the file synchronization process. The file database records the file information of multiple files to be deleted, and the file information includes the file name, storage path and file modification time. The file modification time is the time when the file was last modified before synchronization. Then, according to the file name and storage path of the file to be deleted, the latest modification time of the file to be deleted is queried, and then the file modification time and the latest modification time of the file to be deleted are compared. Finally, when the file modification time and the latest modification time are consistent, the file to be deleted is deleted. The present application can execute the file deletion process multiple times at a preset time interval and perform multiple deletion operations to prevent the file from being successfully deleted. At the same time, it can judge the file update status to prevent the accidental deletion of files that are not synchronized after the update, which is conducive to improving the success rate of file deletion and reducing the risk of accidental deletion.
[0081] In one embodiment, the device 200 further includes: when the file modification time and the latest modification time are inconsistent, skipping and retaining the file to be deleted, and reading the next file to be deleted in the file database.
[0082] In one embodiment, the file information also includes the file synchronization time, and the file deletion module 440 is also used to: determine the target time based on the file modification time and the preset time interval; compare the file synchronization time and the target time; when the file synchronization time is later than the target time, write the file information of the file to be deleted into the target prompt file, and the target prompt file is used to store the file information of the files that have not been successfully deleted for multiple times; and delete the file to be deleted.
[0083] In one embodiment, the file deletion module 440 is further used to output a target prompt file after all the files to be deleted in the file database are read.
[0084] In one embodiment, the file synchronization process is executed at a preset time interval, and the file database is updated at a preset time interval.
[0085] In one embodiment, the data acquisition model 410 is further used to: execute a file deletion process after the file synchronization process completes the file synchronization operation and records the file information of the synchronized file in the file database.
[0086] An embodiment of the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the method for deleting files in the above-mentioned embodiment when executing the computer program.
[0087] An embodiment of the present application also provides a machine-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the method for deleting a file in the above-mentioned embodiment is implemented.
[0088] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method for deleting files in the above embodiment when executed by a processor.
[0089] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0090] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0093] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0094] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0095] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0096] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0097] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for deleting a file, characterized in that: Applied to a server, the method comprises: Execute the file deletion process at a preset time interval, and sequentially read the file information of the files to be deleted in the file database constructed by the file synchronization process, wherein the file database records the file information of multiple files to be deleted, and the file information includes the file name, storage path and file modification time, and the file modification time is the time when the file was last modified before synchronization; According to the file name and storage path of the file to be deleted, query the latest modification time of the file to be deleted; Compare the file modification time of the to-be-deleted file with the latest modification time; When the file modification time is consistent with the latest modification time, the file to be deleted is deleted.
2. The method according to claim 1, characterized in that The method further comprises: When the file modification time is inconsistent with the latest modification time, the to-be-deleted file is skipped and retained, and the next to-be-deleted file in the file database is read.
3. The method according to claim 1, characterized in that: The file information also includes a file synchronization time. When the file modification time and the latest modification time are consistent, deleting the file to be deleted includes: Determine the target time according to the file modification time and the preset time interval; Comparing the file synchronization time with the target time; In the case where the file synchronization time is later than the target time, the file information of the to-be-deleted file is written into a target prompt file, where the target prompt file is used to store the file information of the file that has not been successfully deleted for multiple times; The to-be-deleted file is deleted.
4. The method according to claim 3, characterized in that The method further comprises: After all the files to be deleted in the file database are read, the target prompt file is output.
5. The method according to claim 1, characterized in that The file synchronization process is executed according to the preset time interval, and the file database is updated according to the preset time interval.
6. The method according to claim 1, characterized in that The process of executing the file deletion according to the preset time interval includes: After the file synchronization process completes the file synchronization operation and records the file information of the synchronized file in the file database, the file deletion process is executed.
7. A server, characterized in that: The method is configured to execute the method for deleting files according to any one of claims 1 to 6.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method for deleting a file according to any one of claims 1 to 6 is implemented.
9. A machine-readable storage medium storing a program or instruction, characterized in that: When the program or the instruction is executed by a processor, the method for deleting a file according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the method for deleting a file according to any one of claims 1 to 6.