Directory recovery method and device, electronic equipment, storage medium and program product

By creating the recycling directory in order to control the directory in the directory tree, the directory to be deleted to the recycling directory is to solve the problem of low management efficiency of delete directory management in existing technology, and achieve more efficient directory recycling and management.

CN119336238APending Publication Date: 2025-01-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310898506.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In the prior art, the management of deleted directories in the recycling bin is low, and it is difficult for users to distinguish between directories that need to be retrieved and directories that do not need to be retrieved, resulting in an increased risk of accidentally deleting files.

Method used

In the directory tree to create the recycling directory to control the directory, the directory is moved to the recycling directory, and the user can distinguish the sub -directory that needs to be retrieved in the recycling directory and the child directory that is not required to be recovered to avoid deletion.

Benefits of technology

Through the management of recycling directory, users can more conveniently distinguish between and process the deleted directory, reduce the risk of mistakenly deleting files, and improve the management efficiency of the deleted directory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336238A_ABST
    Figure CN119336238A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a directory recovery method and device, electronic equipment, a storage medium and a program product. The method can be applied to file storage, a to-be-controlled directory in a directory tree is obtained, and the to-be-controlled directory is a directory except a root directory in the directory tree; creating a recovery catalogue at the next level of the to-be-controlled catalogue, wherein the recovery catalogue is used for recovering subcatalogues under the to-be-controlled catalogue; obtaining a to-be-deleted directory from all directories of the directory tree; and when the to-be-deleted catalogue is under the to-be-controlled catalogue, moving the to-be-deleted catalogue to a recovery catalogue to recover the to-be-deleted catalogue. In the embodiment of the invention, the to-be-deleted catalog under the recovery catalog is the deleted catalog, and a user can distinguish the sub-catalog needing to be retrieved and the sub-catalog not needing to be retrieved under the to-be-controlled catalog through the recovery catalog, so that the user is prevented from mistakenly deleting the file indicated by the to-be-deleted catalog, and the management efficiency of the deleted catalog is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a directory recycling method, device, electronic device, storage medium and program product. Background Art

[0002] Directory recycling refers to the process of moving a directory to the Recycle Bin when it is deleted. The Recycle Bin can temporarily store the directory and the files indicated by the directory. When the directory is needed again, the directory and the files indicated by the directory can be retrieved from the Recycle Bin.

[0003] However, there may be multiple deleted directories stored in the Recycle Bin, among which there may be directories that need to be recovered and directories that do not need to be recovered. The hierarchical structures among the multiple deleted directories may be quite different, making it inconvenient for users to distinguish between the directories that need to be recovered and the directories that do not need to be recovered from the multiple deleted directories, resulting in low management efficiency of the deleted directories. Summary of the invention

[0004] The embodiments of the present application provide a directory recovery method, device, electronic device, storage medium and program product, which can improve the management efficiency of deleted directories.

[0005] The present application embodiment provides a directory recycling method, including:

[0006] Get the directory to be controlled in the directory tree, which is the directory other than the root directory in the directory tree;

[0007] Create a recycling directory at the next level of the directory to be controlled. The recycling directory is used to recycle subdirectories under the directory to be controlled.

[0008] Get the directory to be deleted in all directories in the directory tree;

[0009] When the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory to recycle the directory to be deleted.

[0010] The present application also provides a directory recovery device, including:

[0011] An acquisition unit is used to acquire a directory to be controlled in the directory tree, where the directory to be controlled is a directory other than the root directory in the directory tree;

[0012] A creation unit is used to create a recycling directory at the next level of the directory to be controlled, and the recycling directory is used to recycle the subdirectories under the directory to be controlled;

[0013] A deletion unit is used to obtain the directory to be deleted from all directories in the directory tree;

[0014] The recycling unit is used to move the directory to be deleted to the recycling directory when the directory to be deleted is under the directory to be controlled, so as to recycle the directory to be deleted.

[0015] In some embodiments, the directory to be controlled includes multiple sub-directories to be controlled, and the sub-directories to be controlled are sub-directories under the directory to be controlled. After creating a recycling directory at the next level of the directory to be controlled, it also includes:

[0016] Get the recycling keyword associated with the subdirectory to be controlled;

[0017] Based on the recycling keyword, determine the subdirectory to be recycled from multiple subdirectories to be controlled;

[0018] Based on the sub-directories to be recycled, determine the recycling range of the recycling directory, where the recycling range is the range of the sub-directories under the directory to be controlled that are recycled by the recycling directory.

[0019] In some embodiments, after creating a recycling directory at a level below the directory to be controlled, the method further includes:

[0020] Obtain the recycling directory to be published in other directory trees. The hierarchical structure of other directory trees is the same as that of the directory tree except for the recycling directory to be published. The recycling directory to be published is the recycling directory created in other directory trees.

[0021] Based on the previous level of the recovery directory to be released, determine the target directory from all directories in the directory tree, and the target directory is the same as the previous level of the recovery directory to be released;

[0022] A to-be-released recycling directory is created at the next level of the target directory. The to-be-released recycling directory is used to recycle subdirectories under the target directory.

[0023] In some embodiments, when the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes:

[0024] Based on the directory to be deleted, determine a target recycling directory from the recycling directory to be published and the recycling directory, wherein the upper level of the target recycling directory includes the directory to be deleted;

[0025] Move the directory to be deleted to the target recycling directory.

[0026] In some embodiments, obtaining the to-be-deleted directory in all directories in the directory tree includes:

[0027] Get the interaction request sent by the client;

[0028] Based on the interactive request, the recycling directory is sent to the client;

[0029] Get the directory deletion command sent by the client for the recycling directory;

[0030] Based on the directory deletion command, a directory to be deleted is determined in all directories in the directory tree.

[0031] In some embodiments, based on the interactive request, sending the recycling directory to the client includes:

[0032] Get the interaction time, which is the time period of interaction with the client;

[0033] When the interaction time is within the preset time period, the recycling directory is sent to the client.

[0034] In some embodiments, when the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes:

[0035] When the directory to be deleted is under the directory to be controlled, the directory to be deleted is renamed based on the recycling directory to move the directory to be deleted to the recycling directory;

[0036] When the directory to be deleted is not under the directory to be controlled, delete the directory to be deleted in the directory tree.

[0037] In some embodiments, when the directory to be deleted is under the directory to be controlled, the directory to be deleted is renamed based on the reclaimed directory, including:

[0038] When the directory to be deleted is under the directory to be controlled, a position to be inserted is determined in the hierarchical structure of the directory to be deleted, and the position to be inserted is located between the directory to be deleted and the upper level of the directory to be deleted;

[0039] Insert a recycling directory at the position to be inserted so that the directory to be deleted belongs to the recycling directory.

[0040] In some embodiments, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0041] Get the directory clearing instruction for the recycling directory;

[0042] Based on the directory clearing instruction, determine the directory to be cleared from the recycling directory;

[0043] Delete the directory to be cleared.

[0044] In some embodiments, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0045] Get directory restore instructions for the recycled directory;

[0046] Based on the directory restoration instruction, determine the directory to be restored from the subdirectories under the recovery directory;

[0047] Move the directory to be restored out of the recycling directory to reset the directory to be restored in the directory tree.

[0048] In some embodiments, moving the directory to be restored out of the recycling directory includes:

[0049] Based on the recycling directory, determine a level to be deleted from the hierarchical structure of the directory to be restored, where the level to be deleted is the level where the recycling directory is located;

[0050] Delete the level to be deleted in the directory to be restored to move the directory to be restored out of the recycling directory.

[0051] An embodiment of the present application also provides an electronic device, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute the steps in any directory recycling method provided in the embodiment of the present application.

[0052] The embodiment of the present application also provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in any directory recycling method provided in the embodiment of the present application.

[0053] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which implements the steps of any directory recycling method provided in the embodiment of the present application when the computer program / instruction is executed by a processor.

[0054] The embodiment of the present application can obtain a directory to be controlled in a directory tree, where the directory to be controlled is a directory in the directory tree other than the root directory; create a recycling directory at the next level of the directory to be controlled, and the recycling directory is used to recycle the subdirectories under the directory to be controlled; obtain a directory to be deleted in all directories in the directory tree; when the directory to be deleted is under the directory to be controlled, move the directory to be deleted to the recycling directory to recycle the directory to be deleted.

[0055] In the present application, a recycling directory can be created at the next level of the directory to be controlled in the directory tree, so that the recycling directory can specifically recycle the sub-directories under the directory to be controlled. When the directory to be deleted is under the directory to be controlled, the directory to be deleted can be moved from the directory to be controlled to the recycling directory, that is, the directory to be deleted is the deleted directory. Since the directory to be deleted under the recycling directory comes from the sub-directory under the directory to be controlled, it is convenient for users to distinguish between the sub-directories that need to be retrieved under the directory to be controlled and the sub-directories that do not need to be retrieved in the directory to be deleted under the recycling directory, so as to avoid accidentally deleting files indicated by the directory to be deleted. In this way, it is convenient to manage the deleted directory and improve the management efficiency of the deleted directory. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0057] Figure 1a is a scenario diagram of a directory recycling method provided in an embodiment of the present application;

[0058] Figure 1b is a flowchart of a directory recovery method provided in an embodiment of the present application;

[0059] Figure 2a It is a schematic diagram of a scenario for creating a recycling rule provided in an embodiment of the present application;

[0060] Figure 2b is a schematic diagram of the registration recovery rules provided in the embodiment of the present application;

[0061] Figure 2c is a schematic diagram of a storage recycling rule provided in an embodiment of the present application;

[0062] Figure 2d It is a schematic diagram of synchronization of recycling rules provided in an embodiment of the present application in a distributed storage system;

[0063] Figure 2e This is a first schematic diagram of the recycling rule provided in the embodiment of the present application being sent to the client;

[0064] Figure 2f This is a second schematic diagram of the recycling rule provided in the embodiment of the present application being sent to the client;

[0065] Figure 2g It is a flow chart of catalog recycling of the embodiment of the present application;

[0066] Figure 3 is a schematic diagram of the structure of a directory recovery device provided in an embodiment of the present application;

[0067] Figure 4 It is a schematic diagram of the structure of the server provided in the embodiment of the present application. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not 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 this application.

[0069] Embodiments of the present application provide a directory recycling method, device, electronic device, storage medium, and program product.

[0070] The directory recovery device can be integrated into an electronic device, which can be a terminal, a server, etc. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, or a personal computer (PC); the server can be a single server or a server cluster composed of multiple servers.

[0071] In some embodiments, the directory recovery device may also be integrated into multiple electronic devices. For example, the directory recovery device may be integrated into multiple servers, and the directory recovery method of the present application may be implemented by multiple servers.

[0072] In some embodiments, the server may also be implemented in the form of a terminal.

[0073] For example, refer to Figure 1a The electronic device can obtain a directory to be controlled 01 in the directory tree, where the directory to be controlled 01 is a directory other than the root directory in the directory tree; create a recycling directory 02 at the next level of the directory to be controlled, where the recycling directory 02 is used to recycle the subdirectories under the directory to be controlled 01; obtain a directory to be deleted 03 in all directories in the directory tree; when the directory to be deleted 03 is under the directory to be controlled 01, move the directory to be deleted 03 to the recycling directory 02 to recycle the directory to be deleted.

[0074] Among them, a recycling directory can be created at the next level of the directory to be controlled in the directory tree, so that the recycling directory can specifically recycle the subdirectories under the directory to be controlled. When the directory to be deleted is under the directory to be controlled, the directory to be deleted can be moved from the directory to be controlled to the recycling directory, that is, the directory to be deleted is the deleted directory. Because the directory to be deleted under the recycling directory comes from the subdirectory under the directory to be controlled, it is convenient for users to distinguish between the subdirectories that need to be retrieved under the directory to be controlled and the subdirectories that do not need to be retrieved in the directory to be deleted under the recycling directory, so as to avoid accidentally deleting files indicated by the directory to be deleted. In this way, it is convenient to manage the deleted directory and improve the management efficiency of the deleted directory.

[0075] It should be noted that the serial numbers of the following embodiments are not intended to limit the preferred order of the embodiments.

[0076] In this embodiment, a directory recycling method is provided, such as Figure 1b As shown, the specific process of the directory recycling method can be as follows:

[0077] 110. Obtain a directory to be controlled in the directory tree, where the directory to be controlled is a directory other than the root directory in the directory tree.

[0078] The directory tree is a tree that shows the parent-child relationship between directories. For example, the directory tree can be a directory tree existing in a text, server, operating system, database system, etc.

[0079] The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0080] The directory to be controlled may be any directory except the root directory in the directory tree. For example, the directory to be controlled may be a directory in the directory tree selected by a system administrator or a user, and the system administrator or the user may pass the directory to be controlled in the directory tree to the system through a command.

[0081] The root directory is the topmost directory in the directory tree, that is, it is located at the top of the directory tree and is used to organize and manage directories in the directory tree except the root directory.

[0082] For example, the root directory of directory tree T1 is directory A, and the directories connected to directory A include directory B and directory C. Directory B is connected to directory b1, directory b1 is connected to directory b2, and directory C is connected to directory c1. The directory to be controlled can be any one of directory B, directory C, directory b1, directory b2, and directory c1.

[0083] In some embodiments, in order to obtain a directory to be controlled, obtaining the directory to be controlled in the directory tree includes:

[0084] Obtaining a recovery directory creation command for a directory tree, wherein the recovery directory creation command includes a control keyword;

[0085] Based on the control keyword, the directory to be controlled is obtained from the recycling directory creation command, where the directory to be controlled is a directory associated with the control keyword.

[0086] The recycling directory creation command refers to a command for creating a recycling directory, and the command may be issued by a system administrator or a user.

[0087] The control keyword is used to indicate that a recycling directory is created at the next level of the directory to be controlled. For example, the control keyword may be a key, and the directory associated with the key in the directory tree is the directory to be controlled.

[0088] 120. Create a recycling directory at the next level of the directory to be controlled. The recycling directory is used to recycle subdirectories under the directory to be controlled.

[0089] The next level of the directory to be controlled is a location under the directory to be controlled that can be directly connected to the directory to be controlled.

[0090] The recycling directory is located at the next level of the directory to be controlled and is used to recycle the subdirectories under the directory to be controlled.

[0091] For example, if the directory to be controlled is directory B in the above directory tree T1, the next level of directory B is in parallel with directory b1, that is, the recycled directory t1 is in parallel with directory b1. In this way, the recycled directory t1 can be used to recycle directories b1 and b2 under directory B.

[0092] In some embodiments, the recycling directory creation command includes a recycling keyword associated with the directory to be controlled. To create the recycling directory, a recycling directory is created at a level below the directory to be controlled, including:

[0093] Obtain the recycling keyword associated with the directory to be controlled in the recycling directory creation command;

[0094] Based on the recycling keywords associated with the directory to be controlled, a recycling directory is created at the next level of the directory to be controlled.

[0095] The recycling keyword associated with the directory to be controlled is used to limit whether to enable the recycling directory at the next level of the directory to be controlled.

[0096] For example, the recycling function (value) {include / exclude} can use 0 to represent include and 1 to represent exclude. 0 can indicate that the recycling function is enabled and 1 can indicate that the recycling function is not enabled. If the recycling keyword associated with the directory to be controlled is 0, it indicates that a recycling directory can be created at the next level of the directory to be controlled.

[0097] In some embodiments, considering that the subdirectories under the to-be-controlled directory may not need to be recycled, in order to reduce the subdirectories under the to-be-controlled directory that can be recycled by the recycling directory, so that the recycling directory is convenient for managing the recycled subdirectories, the to-be-controlled directory includes multiple to-be-controlled subdirectories, and the to-be-controlled subdirectories are subdirectories under the to-be-controlled directory. After creating the recycling directory at the next level of the to-be-controlled directory, it also includes:

[0098] Get the recycling keyword associated with the subdirectory to be controlled;

[0099] Based on the recycling keyword, determine the subdirectory to be recycled from multiple subdirectories to be controlled;

[0100] Based on the sub-directories to be recycled, determine the recycling range of the recycling directory, where the recycling range is the range of the sub-directories under the directory to be controlled that are recycled by the recycling directory.

[0101] The subdirectory to be controlled is a subdirectory under the directory to be controlled. For example, if the directory to be controlled is directory B in the directory tree T1, the subdirectory to be controlled includes directory b1 and directory b2 under directory B, and so on.

[0102] The recycle keyword is used to indicate whether the subdirectory to be controlled can be reclaimed below the recycle directory.

[0103] For example, the recycling keyword associated with the subdirectory to be controlled can be exclude, or 1 indicating exclude, which is used to indicate that the subdirectory to be controlled cannot be recycled below the recycling directory. The recycling keyword associated with the subdirectory to be controlled can also be include, or 0 indicating include, which is used to indicate that the subdirectory to be controlled can be recycled below the recycling directory, and so on.

[0104] The subdirectory to be recycled is a subdirectory to be controlled that can be recycled to the recycling directory.

[0105] For example, if the recycling keyword is 1, the subdirectory to be recycled is a subdirectory to be controlled that is not associated with 1, and if the recycling keyword is 0, the subdirectory to be recycled is a subdirectory to be controlled that is associated with 0.

[0106] The recycling range is the range of subdirectories under the directory to be controlled that are recycled by the recycling directory. The recycling range is used to indicate that the recycling directory can recycle the subdirectories to be recycled.

[0107] For example, from the above example, it can be seen that the recycling directory can be in the next level of directory B and be in a parallel position with directory b1, that is, the recycling directory can recycle directory b1 and directory b2 under directory B. If the keyword associated with directory b1 is 1, which is used to refer to exclude, then the subdirectory to be recycled under directory B is directory b2. In this way, the recycling scope of the recycling directory only includes directory b2 under directory B.

[0108] In some embodiments, considering that the directory tree may be located in a distributed storage system, the directory tree is divided into multiple parts, and there are multiple metadata servers (MDS) in the distributed storage system. Each MDS manages part of the directories in the distributed storage system respectively. In order to enable an MDS to create a recycling directory in the managed part of the directory, the recycling directory can be synchronized to other MDSs, so that each MDS in the distributed storage system has the same directory tree, so that when a user accesses each MDS, all recycling directories created on the directory can be known. After the recycling directory is created at the next level of the directory to be controlled, it also includes:

[0109] Obtain the recycling directory to be published in other directory trees. The hierarchical structure of other directory trees is the same as that of the directory tree except for the recycling directory to be published. The recycling directory to be published is the recycling directory created in other directory trees.

[0110] Based on the previous level of the recovery directory to be released, determine the target directory from all directories in the directory tree, and the target directory is the same as the previous level of the recovery directory to be released;

[0111] A to-be-released recycling directory is created at the next level of the target directory. The to-be-released recycling directory is used to recycle subdirectories under the target directory.

[0112] Among them, other directory trees and the directory tree are in different metadata servers in the same distributed storage system. Except for the recycled directory to be released, the other directory trees have the same hierarchical structure as the directory tree, that is, they have all the directories in the directory tree, and the connection relationship between the directories is the same as the connection relationship between the directories in the directory tree.

[0113] For example, a recycling directory t1 is created in the directory tree T1, and another directory tree T2 has all the directories in the directory tree T1, including the recycling directory t1 in the directory tree T1.

[0114] The recycling directory to be published is a recycling directory created in other directory trees and has not been synchronized to directory trees other than other directory trees in the same distributed storage system.

[0115] For example, a recycling directory t2 is created in the other directory tree T2, and the directory tree T1 includes all directories in the directory tree T2 except the recycling directory t2, then the recycling directory to be published is the recycling directory t2.

[0116] The upper level of the to-be-released recovery directory is a position on the to-be-released recovery directory in other directory trees that can be directly connected to the to-be-released recovery directory.

[0117] For example, the other directory tree T2 includes directory A, and the directories connected to directory A include directory B and directory C. Directory B is connected to directory b1, directory b1 is connected to directory b2, directory C is connected to directory c1, a recycling directory t1 is created at the next level of directory B, and a recycling directory t2 is created at the next level of directory C. Directory tree T1 includes all directories in other directory tree T2 except recycling directory t2, that is, the recycling directory to be released is recycling directory t2.

[0118] The target directory is the directory at the same level as the directory to be released and recycled in the directory tree.

[0119] For example, if the recycling directory to be published is recycling directory t2 of another directory tree T2, and the previous level of recycling directory t2 is directory C, then the target directory is directory C in directory tree T1.

[0120] 130. Get the directory to be deleted from all directories in the directory tree.

[0121] The directory to be deleted is a directory that needs to be deleted from the directory tree, and can be any directory in the directory tree. For example, the directory to be deleted can be a root directory, or a directory other than the root directory.

[0122] In some embodiments, in order to allow the user to know the recycling directory created in the directory tree to avoid the user from accidentally deleting the directory, the directory to be deleted is obtained from all the directories in the directory tree, including:

[0123] Get the interaction request sent by the client;

[0124] Based on the interactive request, the recycling directory is sent to the client;

[0125] Get the directory deletion command sent by the client for the recycling directory;

[0126] Based on the directory deletion command, a directory to be deleted is determined in all directories in the directory tree.

[0127] The client is used for users to manage the directory tree. For example, the client can be a mobile smart terminal, a computer, a physical machine, etc.

[0128] The interaction request is a request sent by the client to interact with the system. The system represents the storage relationship between files in the system through a directory tree.

[0129] For example, an interaction request may be a session request, which is used to request the establishment of a communication channel between the client and the system so that the client and the system can interact. An interaction request may also be a file editing request, which is used to allow the client to access the system and edit files in the system. An interaction request may also be a directory operation request, which is used to manage directories in the system.

[0130] The directory deletion command is a command sent by the user to delete a directory in the directory tree after the user learns about the recycled directory in the directory tree.

[0131] For example, if the directory deletion command indicates that the directory b1 in the above directory tree T1 needs to be deleted, the directory to be deleted is the directory b1.

[0132] In some embodiments, in order to enable the user to understand the recycled directory in the directory tree, the recycled directory is sent to the client based on the interactive request, including:

[0133] Get the interaction time, which is the time period of interaction with the client;

[0134] When the interaction time is within the preset time period, the recycling directory is sent to the client.

[0135] The interaction time is the time for interaction between the client and the system, and the system represents the storage relationship between files in the system through a directory tree.

[0136] The preset time period is used to measure the interaction time between the client and the system.

[0137] For example, during the interaction time between the client and the system, the recycling directory t1 set in the directory tree T1 can be sent to the client within a preset time period, so that the user can know the recycling directory t1 set in the directory tree T1, and the user can use the recycling directory t1 to prevent accidental deletion of the directory.

[0138] In some embodiments, in order to provide feedback to the client of a recycling directory created in a directory tree when the client interacts with the system, when the interaction time is within a preset time period, sending the recycling directory to the client includes:

[0139] When the interaction time is within a preset time period, obtaining a directory transfer command associated with the client;

[0140] Based on the directory transfer command, the recovery directory is sent to the client.

[0141] The directory transfer command is used to instruct the system to send a recycling directory to the client so that the user can obtain the recycling directory created in the directory tree through the client. The system can represent the storage relationship between files in the system through the directory tree.

[0142] For example, the directory transfer command may be a directory transfer command associated with the client and generated by the system when the interaction time is within a preset time period, or may be a directory transfer command sent by the client, and so on.

[0143] 140. When the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory to recycle the directory to be deleted.

[0144] For example, if the recycling directory t1 is at the next level of the above-mentioned directory B, and the directory to be deleted is the above-mentioned directory b1, the directory b1 can be moved below the recycling directory t1 by renaming, dragging, etc.

[0145] Considering that directory b2 connected to directory b1 cannot work properly after being moved to recycling directory t1, when the directory to be deleted is directory b1, directory b1 and directory b2 connected to directory b1 can be moved to recycling directory t1.

[0146] If the directory to be deleted is the above-mentioned directory b2, the directory b2 is moved below the recycling directory t1, and so on.

[0147] In some embodiments, considering that multiple recycling directories are created in the directory tree, in order to determine a recycling directory that matches the directory to be deleted from the multiple recycling directories so that the recycling directory can recycle the directory to be deleted, when the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes:

[0148] Based on the directory to be deleted, determine a target recycling directory from the recycling directory to be published and the recycling directory, wherein the upper level of the target recycling directory includes the directory to be deleted;

[0149] Move the directory to be deleted to the target recycling directory.

[0150] The target recycling directory is a recycling directory that can recycle the directory to be deleted, and the upper level of the recycling directory includes the directory to be deleted.

[0151] For example, from the above, it can be seen that the recycling directory can be recycling directory t1, and the recycling directory to be released can be recycling directory t2. If the directory to be deleted is the above-mentioned directory b2, directory b2 is a subdirectory of directory b1, the previous level of directory b1 is directory B, the previous level of recycling directory t1 is directory B, and the previous level of recycling directory t2 is directory C. Since the previous level of recycling directory t1 and directory b2 is the same, which is directory B, that is, the target recycling directory is recycling directory t1, directory b2 is moved from directory b1 to recycling directory t1.

[0152] In some embodiments, considering that the directory to be deleted may be a subdirectory of the directory to be controlled, or other directories besides the directory to be controlled, in order to delete the directory to be deleted, when the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory, including:

[0153] When the directory to be deleted is under the directory to be controlled, the directory to be deleted is renamed based on the recycling directory to move the directory to be deleted to the recycling directory;

[0154] When the directory to be deleted is not under the directory to be controlled, delete the directory to be deleted in the directory tree.

[0155] For example, if the directory to be controlled is directory B, and the directory to be deleted is directory b1 or directory b2, and the recycled directory t1 is the next level of directory B, and directory b1 or directory b2 is under directory B, then directory b1 or directory b2 can be renamed based on recycled directory t1 so that directory b1 or directory b2 can be moved under recycled directory t1. When the directory to be deleted is directory A, directory B, directory C, directory c1, and directory A, directory B, directory C, directory c1 are not under directory B, then directory A, directory B, directory C, directory c1 are directly deleted from the directory tree.

[0156] In some embodiments, in order to move the directory to be deleted below the recycling directory, when the directory to be deleted is under the directory to be controlled, the directory to be deleted is renamed based on the recycling directory, including:

[0157] When the directory to be deleted is under the directory to be controlled, a position to be inserted is determined in the hierarchical structure of the directory to be deleted, and the position to be inserted is located between the directory to be deleted and the upper level of the directory to be deleted;

[0158] Insert a recycling directory at the position to be inserted so that the directory to be deleted belongs to the recycling directory.

[0159] The hierarchical structure of the directory to be deleted is the position of the directory to be deleted in the directory tree.

[0160] For example, it can be seen from the above directory tree that if the directory to be deleted is directory b1, the hierarchical structure of directory b1 is / directory A / directory B / directory b1.

[0161] The position to be inserted is a position between the directory to be deleted and the upper level of the directory to be deleted.

[0162] For example, if the directory to be deleted is directory b1, and the hierarchical structure of directory b1 is / directory A / directory B / directory b1, then the position to be inserted is the position between directory b1 and directory B, and the recycled directory t1 is inserted at the position to be inserted, and the result is / directory A / directory B / recycled directory t1 / directory b1, so that directory b1 is moved to the recycled directory t1, so that the directory to be deleted belongs to the recycled directory t1.

[0163] In some embodiments, in order to clear the recycling directory, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0164] Get the directory clearing instruction for the recycling directory;

[0165] Based on the directory clearing instruction, determine the directory to be cleared from the recycling directory;

[0166] Delete the directory to be cleared.

[0167] The directory clearing instruction is an instruction for deleting the recycling directory. For example, the directory clearing instruction may be an instruction for clearing the recycling directory sent by a system administrator or a user, and so on.

[0168] The directory to be emptied is a recycling directory that needs to be deleted in the directory tree.

[0169] For example, if the directory tree includes recycling directories t1 and t2, the directory clearing instruction includes the identifier of the recycling directory to be deleted. Based on the identifier, the directory to be cleared can be screened out from recycling directories t1 and t2 and deleted from the directory tree.

[0170] In some embodiments, in order to move the directory to be restored out of the recycling directory, when the directory to be deleted is in the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0171] Get directory restore instructions for the recycled directory;

[0172] Based on the directory restoration instruction, determine the directory to be restored from the subdirectories under the recovery directory;

[0173] Move the directory to be restored out of the recycling directory to reset the directory to be restored in the directory tree.

[0174] The directory restoration instruction is an instruction to move the directory to be restored out of the recycling directory.

[0175] The directory to be restored is the subdirectory that needs to be moved out of the recovery directory.

[0176] For example, as can be seen from the aforementioned directory tree, if the recycled directory t1 includes directory b1, when the directory to be restored is directory b1, directory b1 can be moved out of the recycled directory t1 by dragging or renaming, that is, / directory A / directory B / recycled directory t1 / directory b1 is changed to / directory A / directory B / directory b1, so that directory b1 is moved from under the recycled directory t1 to under directory B, thereby resetting directory b1 in the directory tree.

[0177] In some embodiments, in order to remove the directory to be restored from the recycling directory, removing the directory to be restored from the recycling directory includes:

[0178] Based on the recycling directory, determine a level to be deleted from the hierarchical structure of the directory to be restored, where the level to be deleted is the level where the recycling directory is located;

[0179] Delete the level to be deleted in the directory to be restored to move the directory to be restored out of the recycling directory.

[0180] The hierarchical structure of the directory to be restored is the location of the directory to be restored in the directory tree.

[0181] The level to be deleted is the level at which the recycling directory is located in the hierarchical structure of the directory to be restored.

[0182] For example, if the directory to be restored is directory b1, and the hierarchical structure of the directory to be restored is / directory A / directory B / recycled directory t1 / directory b1, then the hierarchy to be deleted is / directory A / directory B / recycled directory t1 / directory b1. Recycled directory t1 is deleted to obtain / directory A / directory B / directory b1, and directory b1 is moved from under recycled directory t1 to under directory B, so as to move the directory to be restored out of the recycled directory, thereby resetting directory b1 in the directory tree.

[0183] For example, if the directory tree is a directory tree in a text (electronic text, paper, etc.), the user can create a recycling directory under the directory to be controlled in the directory tree during the text editing process to avoid accidentally deleting subdirectories under the directory to be controlled. If subdirectory x under the directory to be controlled is deleted, the subdirectory x will be moved to the recycling directory so that the recycling directory can temporarily store subdirectory x, and when subdirectory x is needed again, subdirectory x can be quickly retrieved under the recycling directory, or when subdirectory x is not needed, the recycling directory can be directly deleted to permanently delete subdirectory x under the recycling directory. In this way, it is convenient for users to centrally manage deleted subdirectories under the directory to be controlled through the recycling directory, which improves the management efficiency of deleted directories.

[0184] For example, a recycling directory can be created at the next level of the directory to be controlled in the directory tree, so that the recycling directory can specifically recycle the subdirectories under the directory to be controlled. When the directory to be deleted is under the directory to be controlled, the directory to be deleted can be moved from the directory to be controlled to the recycling directory, that is, the directory to be deleted is the deleted directory. Because the directory to be deleted under the recycling directory comes from the subdirectory under the directory to be controlled, it is convenient for users to distinguish between the subdirectories that need to be retrieved under the directory to be controlled and the subdirectories that do not need to be retrieved in the directory to be deleted under the recycling directory. In this way, the directory to be deleted can be managed through the recycling directory, and accidental deletion of files indicated by the directory to be deleted can be avoided, thereby improving the management efficiency of the deleted directory.

[0185] From the above, it can be seen that the embodiment of the present application can obtain the directory to be controlled in the directory tree, and the directory to be controlled is the directory in the directory tree except the root directory; create a recycling directory at the next level of the directory to be controlled, and the recycling directory is used to recycle the subdirectories under the directory to be controlled; obtain the directory to be deleted in all directories in the directory tree; when the directory to be deleted is under the directory to be controlled, move the directory to be deleted to the recycling directory to recycle the directory to be deleted.

[0186] Therefore, in this scheme, a recycling directory can be created at the next level of the directory to be controlled in the directory tree, so that the recycling directory can specifically recycle the subdirectories under the directory to be controlled. When the directory to be deleted is under the directory to be controlled, the directory to be deleted can be moved from the directory to be controlled to the recycling directory, that is, the directory to be deleted is the deleted directory. Because the directory to be deleted under the recycling directory comes from the subdirectory under the directory to be controlled, it is convenient for users to distinguish between the subdirectories that need to be retrieved under the directory to be controlled and the subdirectories that do not need to be retrieved in the directory to be deleted under the recycling directory, so as to avoid accidentally deleting files indicated by the directory to be deleted. In this way, it is convenient to manage the deleted directory and improve the management efficiency of the deleted directory.

[0187] The method described in the above embodiment will be further described in detail below.

[0188] In this embodiment, if Figure 2a As shown, taking registering recycling rules in a recycling distributed storage system and sending the registered recycling rules to the client as an example, the method of the embodiment of the present application is described in detail.

[0189] The specific process of a directory recycling method is as follows:

[0190] 210. Registering a recycling rule in a metadata server in a distributed storage system, the recycling rule including a directory to be controlled in a directory tree, the directory to be controlled including a subdirectory to be recycled;

[0191] For example, a recycling rule could be:

[0192] Control keyword (key): {hierarchical structure (path)}, recycling function (value): {recycling keyword: include (include) / exclude (exclude)}, 0 means include, 1 means exclude;

[0193] Example:

[0194] key: / root directory(fs) / data(data), value: 0;

[0195] key: / fs / data / subdata, value: 1.

[0196] Among them, the directory corresponding to the control keyword (key) and the recycling keyword (value) of 0 is the directory to be controlled, that is, / fs / data, and its associated value is 0, indicating that the recycling function is enabled under the directory data. / fs / data / subdata is a subdirectory of / fs / data, and its associated value is 1, indicating that the recycling function is not enabled for / fs / data / subdata.

[0197] In some embodiments, Figure 2b As shown, the recycling rules are registered in the metadata server in the distributed storage system, including:

[0198] Use the command line (cmd) process to send the recycling rules to the unix domain socket (unix socket);

[0199] The admin socket module in the metadata server (MDS) detects the unix socket and receives the recycling rules;

[0200] The admin socket module sends the received recycling rules to the metadata server ranking module (mdsrank module) for processing;

[0201] The mdsrank module parses the recycling rules and saves them in the recycling rule instance within the mdsrank module.

[0202] The cmd process is a command line interpreter in the operating system. It is an executable file used to execute commands and scripts in the command prompt. Through the cmd process, users can use various commands to interact with the operating system, manage files and directories, configure system settings, etc.

[0203] Unix socket is a mechanism for inter-process communication on Unix-like operating systems. It allows processes on the same host to communicate through file system paths without transmitting data over the network.

[0204] The admin socket module refers to an interface or mechanism in MDS, which is used to detect the unix socket to receive commands and requests from the unix socket. In this way, the admin socket module can receive the recycling rules sent by the unix socket.

[0205] The mdsrank module refers to a component in MDS that is responsible for processing and making decisions about metadata-related operations and tasks. In this way, the mdsrank module can manage the directory tree through recycling rules.

[0206] 220. Create a recycling directory at the next level of the directory to be controlled, and the recycling directory is used to recycle the subdirectories under the directory to be controlled.

[0207] In some embodiments, the directory to be controlled includes multiple sub-directories to be controlled, and the sub-directories to be controlled are sub-directories under the directory to be controlled. After creating a recycling directory at the next level of the directory to be controlled, it also includes:

[0208] Get the recycling keyword associated with the subdirectory to be controlled;

[0209] Based on the recycling keyword, determine the subdirectory to be recycled from multiple subdirectories to be controlled;

[0210] Based on the sub-directories to be recycled, determine the recycling range of the recycling directory, where the recycling range is the range of the sub-directories under the directory to be controlled that are recycled by the recycling directory.

[0211] For example, as mentioned above, / fs / data is the directory to be controlled, that is, a recovery directory is created under / fs / data, fs / data / subdata is a subdirectory of / fs / data, and its associated value is 1, indicating that the recovery function of / fs / data / subdata is not enabled, that is, the subdirectories to be controlled except fs / data / subdata are subdirectories to be recovered. Through the subdirectories to be recovered, the recovery range of the recovery directory can be obtained, that is, the recovery range of the recovery directory includes the subdirectories to be controlled except fs / data / subdata.

[0212] In some embodiments, after creating a recycling directory at a level below the directory to be controlled, the method further includes:

[0213] like Figure 2c As shown, the mdsrank module of MDS passes the recycling rules to the object processor (objecter) module;

[0214] The objecter module encapsulates the recycling rules into persistent messages and sends them to the distributed scalable object storage (rados) in the distributed storage system;

[0215] like Figure 2d As shown, rados stores the recycling rule into the trash rule object and increases the version of the recycling rule to notify other MDSs to synchronize the rules.

[0216] Each MDS in the distributed storage system detects the trash rule object in rados through the subscription module;

[0217] When an MDS registers a recycling rule, it updates the trash rule object and version;

[0218] When the version is updated, all MDSs in the distributed storage system are notified through the subscription module to read the recycling rules from the trash rule object to create recycling directories in other directory trees. The hierarchical structure of other directory trees is the same as that of the directory tree except for the recycling directory.

[0219] The objecter module is used to process operations related to object storage. It provides a set of interfaces (APIs) that allow MDS to interact with rados in the distributed storage system to perform operations such as reading, writing, and deleting objects.

[0220] Rados is used to store data in multiple systems in a dispersed manner, thus realizing distributed storage of data. That is, Rados can be used to encapsulate persistent messages with storage recycling rules.

[0221] The trash rule object is an object that stores recycling rules in rados.

[0222] version is the version of the recycling rule stored in the trash rule object. When the trash rule object receives the recycling rule, the version will be updated.

[0223] 230. Get the directory to be deleted from all directories in the directory tree.

[0224] In some embodiments, obtaining the to-be-deleted directory in all directories in the directory tree includes:

[0225] Get the interaction request sent by the client;

[0226] Based on the interactive request, the recycling directory is sent to the client;

[0227] Get the directory deletion command sent by the client for the recycling directory;

[0228] Based on the directory deletion command, a directory to be deleted is determined in all directories in the directory tree.

[0229] For example, Figure 2e As shown, the client sends an interaction request (session creation request) to the MDS. When the mdsrank module of the MDS receives the session creation request, it sends the recycling rules in the memory back to the client. The client parses the recycling rules from the response of the session creation request so that the user can send a directory deletion command for the recycling directory.

[0230] In some embodiments, based on the interactive request, sending the recycling directory to the client includes:

[0231] Get the interaction time, which is the time period of interaction with the client;

[0232] When the interaction time is within the preset time period, the recycling directory is sent to the client.

[0233] For example, Figure 2f As shown, after the client interacts with the distributed storage system for a period of time, the user needs to set recycling rules. At this time, through the cmd process, a request (apply) {client entity} is sent to the admin socket module of MDS. The admin socket module forwards the request to the mdsrank module. The mdsrank module sends the stored recycling rules to the client through an additional message. The client takes out the recycling rules from the additional message and updates them to the memory, so that the user can send a directory deletion command for the recycling directory.

[0234] 240. When the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory to recycle the directory to be deleted.

[0235] For example, Figure 2g As shown, after the client has a recycling rule, it can obtain the recycling directory in the directory tree from the recycling rule. When the user sends a directory deletion command through the client, the MDS obtains the directory to be deleted from the directory deletion command, and matches the directory to be deleted with the recycling directory in the directory tree. If they match, a rename operation is performed on the directory to be deleted to put the directory to be deleted into the recycling directory.

[0236] For example, the recycling rule is key: / fs / data / subdata, value:0, which indicates that a recycling directory is created at the next level of / fs / data / subdata. At this time, the user wants to delete a file (test) / fs / data / subdata / test under subdata. The user can use the client to first create a .trash (recycling) directory under the / fs / data / subdata directory as recycling, and then rename / fs / data / subdata / test to / fs / data / subdata / .trash / test to recycle / fs / data / subdata / test.

[0237] In some embodiments, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0238] Get directory restore instructions for the recycled directory;

[0239] Based on the directory restoration instruction, determine the directory to be restored from the subdirectories under the recovery directory;

[0240] Based on the recycling directory, determine a level to be deleted from the hierarchical structure of the directory to be restored, where the level to be deleted is the level where the recycling directory is located;

[0241] Delete the level to be deleted in the directory to be restored to move the directory to be restored out of the recycling directory and reset the directory to be restored in the directory tree.

[0242] For example, the restore operation of the recycling directory is to restore it through the renaming operation, that is, in the example, / fs / data / subdata / .trash / test is renamed to / fs / data / subdata / test, and the directory to be restored is reset in the directory tree.

[0243] In some embodiments, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0244] Get the directory clearing instruction for the recycling directory;

[0245] Based on the directory clearing instruction, determine the directory to be cleared from the recycling directory;

[0246] Delete the directory to be cleared.

[0247] For example, the recycling directory temporarily stores the directories to be deleted and the files indicated by the directories to be deleted, which will occupy the space of the distributed storage system. When the user wants to actually delete the useless files and free up space, the recycle bin needs to be emptied, and emptying only requires deleting the corresponding recycling directory.

[0248] As can be seen from the above, this solution implements a directory recycling method for a distributed storage system, using Rados to share storage recycling rules and publish them to the client through MDS, so that the client can implement the directory recycling function through the recycling rules. This method can avoid redefining the deletion operation, without user perception, and reduce the risk of data loss due to misoperation.

[0249] In order to better implement the above method, the embodiment of the present application also provides a directory recovery device, which can be integrated in an electronic device, and the electronic device can be a terminal, a server, etc. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.

[0250] For example, in this embodiment, the method of the embodiment of the present application will be described in detail by taking the directory recovery device being specifically integrated in the server as an example.

[0251] For example, Figure 3 As shown, the directory recycling device may include an acquisition unit 310, a creation unit 320, a deletion unit 330, and a recycling unit 340, as follows:

[0252] (i) Acquisition unit 310.

[0253] The acquisition unit 310 is used to acquire the directory to be controlled in the directory tree. The directory to be controlled is the directory other than the root directory in the directory tree.

[0254] (ii) creating unit 320.

[0255] The creation unit 320 is used to create a recycling directory at a level below the directory to be controlled, and the recycling directory is used to recycle subdirectories under the directory to be controlled.

[0256] In some embodiments, the directory to be controlled includes multiple sub-directories to be controlled, and the sub-directories to be controlled are sub-directories under the directory to be controlled. Creating a recycling directory at a lower level of the directory to be controlled includes:

[0257] Get the recycling keyword associated with the subdirectory to be controlled;

[0258] Based on the recycling keyword, determine the subdirectory to be recycled from multiple subdirectories to be controlled;

[0259] Based on the sub-directories to be recycled, determine the recycling range of the recycling directory, where the recycling range is the range of the sub-directories under the directory to be controlled that are recycled by the recycling directory.

[0260] In some embodiments, after creating a recycling directory at a level below the directory to be controlled, the method further includes:

[0261] Obtain the recycling directory to be published in other directory trees. The hierarchical structure of other directory trees is the same as that of the directory tree except for the recycling directory to be published. The recycling directory to be published is the recycling directory created in other directory trees.

[0262] Based on the previous level of the recovery directory to be released, determine the target directory from all directories in the directory tree, and the target directory is the same as the previous level of the recovery directory to be released;

[0263] A to-be-released recycling directory is created at the next level of the target directory. The to-be-released recycling directory is used to recycle subdirectories under the target directory.

[0264] (iii) Deletion unit 330.

[0265] The deleting unit 330 is used to obtain a directory to be deleted from all directories in the directory tree.

[0266] In some embodiments, obtaining the to-be-deleted directory in all directories in the directory tree includes:

[0267] Get the interaction request sent by the client;

[0268] Based on the interactive request, the recycling directory is sent to the client;

[0269] Get the directory deletion command sent by the client for the recycling directory;

[0270] Based on the directory deletion command, a directory to be deleted is determined in all directories in the directory tree.

[0271] In some embodiments, based on the interactive request, sending the recycling directory to the client includes:

[0272] Get the interaction time, which is the time period of interaction with the client;

[0273] When the interaction time is within the preset time period, the recycling directory is sent to the client.

[0274] (iv) Recovery unit 340.

[0275] The recycling unit 340 is used to move the directory to be deleted to the recycling directory when the directory to be deleted is under the directory to be controlled, so as to recycle the directory to be deleted.

[0276] In some embodiments, when the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes:

[0277] Based on the directory to be deleted, determine a target recycling directory from the recycling directory to be published and the recycling directory, wherein the upper level of the target recycling directory includes the directory to be deleted;

[0278] Move the directory to be deleted to the target recycling directory.

[0279] In some embodiments, when the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes:

[0280] When the directory to be deleted is under the directory to be controlled, the directory to be deleted is renamed based on the recycling directory to move the directory to be deleted to the recycling directory;

[0281] When the directory to be deleted is not under the directory to be controlled, delete the directory to be deleted in the directory tree.

[0282] In some embodiments, when the directory to be deleted is under the directory to be controlled, the directory to be deleted is renamed based on the reclaimed directory, including:

[0283] When the directory to be deleted is under the directory to be controlled, a position to be inserted is determined in the hierarchical structure of the directory to be deleted, and the position to be inserted is located between the directory to be deleted and the upper level of the directory to be deleted;

[0284] Insert a recycling directory at the position to be inserted so that the directory to be deleted belongs to the recycling directory.

[0285] In some embodiments, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0286] Get the directory clearing instruction for the recycling directory;

[0287] Based on the directory clearing instruction, determine the directory to be cleared from the recycling directory;

[0288] Delete the directory to be cleared.

[0289] In some embodiments, when the directory to be deleted is under the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes:

[0290] Get directory restore instructions for the recycled directory;

[0291] Based on the directory restoration instruction, determine the directory to be restored from the subdirectories under the recovery directory;

[0292] Move the directory to be restored out of the recycling directory to reset the directory to be restored in the directory tree.

[0293] In some embodiments, moving the directory to be restored out of the recycling directory includes:

[0294] Based on the recycling directory, determine a level to be deleted from the hierarchical structure of the directory to be restored, where the level to be deleted is the level where the recycling directory is located;

[0295] Delete the level to be deleted in the directory to be restored to move the directory to be restored out of the recycling directory.

[0296] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0297] As can be seen from the above, the directory recovery device of this embodiment obtains the directory to be controlled in the directory tree by the acquisition unit, and the directory to be controlled is the directory in the directory tree except the root directory; the creation unit creates a recovery directory at the next level of the directory to be controlled, and the recovery directory is used to recover the subdirectories under the directory to be controlled; the deletion unit obtains the directory to be deleted in all directories in the directory tree; when the directory to be deleted is under the directory to be controlled, the recovery unit moves the directory to be deleted to the recovery directory to recover the directory to be deleted.

[0298] Therefore, in an embodiment of the present application, the directory to be deleted is moved from the directory to be controlled to the recycling directory, that is, the directory to be deleted is the deleted directory. Since the directory to be deleted under the recycling directory comes from the subdirectory under the directory to be controlled, it is convenient for the user to distinguish between the subdirectories that need to be retrieved under the directory to be controlled and the subdirectories that do not need to be retrieved in the directory to be deleted under the recycling directory, so as to avoid accidental deletion of files indicated by the directory to be deleted. In this way, it is convenient to manage the deleted directory and improve the management efficiency of the deleted directory.

[0299] The embodiment of the present application also provides an electronic device, which can be a terminal, a server, etc. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc. The server can be a single server or a server cluster composed of multiple servers, etc.

[0300] In some embodiments, the directory recovery device can also be integrated into multiple electronic devices. For example, the directory recovery device can be integrated into multiple servers, and the xx method of the present application is implemented by multiple servers.

[0301] In this embodiment, the electronic device of this embodiment is a server as an example for detailed description, for example, Figure 4 As shown, it shows a schematic diagram of the structure of the server involved in the embodiment of the present application, specifically:

[0302] The server may include one or more processing core processors 410, one or more computer-readable storage media memories 420, a power supply 430, an input module 440, and a communication module 450. Those skilled in the art will appreciate that Figure 4 The server structure shown in the figure does not constitute a limitation on the server, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0303] The processor 410 is the control center of the server, and uses various interfaces and lines to connect various parts of the entire server. It executes various functions of the server and processes data by running or executing software programs and / or modules stored in the memory 420, and calling data stored in the memory 420. In some embodiments, the processor 410 may include one or more processing cores; in some embodiments, the processor 410 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 410.

[0304] The memory 420 can be used to store software programs and modules. The processor 410 executes various functional applications and data processing by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 420 may also include a memory controller to provide the processor 410 with access to the memory 420.

[0305] The server also includes a power supply 430 for supplying power to various components. In some embodiments, the power supply 430 can be logically connected to the processor 410 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 430 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0306] The server may further include an input module 440, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0307] The server may further include a communication module 450. In some embodiments, the communication module 450 may include a wireless module. The server may perform short-range wireless transmission through the wireless module of the communication module 450, thereby providing wireless broadband Internet access to the user. For example, the communication module 450 may be used to help the user send and receive emails, browse web pages, and access streaming media.

[0308] Although not shown, the server may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 410 in the server will load the executable files corresponding to the processes of one or more application programs into the memory 420 according to the following instructions, and the processor 410 will run the application programs stored in the memory 420, thereby realizing various functions, as follows:

[0309] Get the directory to be controlled in the directory tree, which is the directory other than the root directory in the directory tree;

[0310] Create a recycling directory at the next level of the directory to be controlled. The recycling directory is used to recycle subdirectories under the directory to be controlled.

[0311] Get the directory to be deleted in all directories in the directory tree;

[0312] When the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory to recycle the directory to be deleted.

[0313] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0314] From the above, it can be seen that the directory to be deleted is moved from the directory to be controlled to the recycling directory, that is, the directory to be deleted is the deleted directory. Because the directory to be deleted under the recycling directory comes from the subdirectory under the directory to be controlled, it is convenient for users to distinguish between the subdirectories that need to be retrieved under the directory to be controlled and the subdirectories that do not need to be retrieved in the directory to be deleted under the recycling directory, so as to avoid accidental deletion of files indicated by the directory to be deleted. In this way, it is convenient to manage the deleted directory and improve the management efficiency of the deleted directory.

[0315] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0316] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the directory recycling methods provided in the embodiment of the present application. For example, the instructions can execute the following steps:

[0317] Get the directory to be controlled in the directory tree, which is the directory other than the root directory in the directory tree;

[0318] Create a recycling directory at the next level of the directory to be controlled. The recycling directory is used to recycle subdirectories under the directory to be controlled.

[0319] Get the directory to be deleted in all directories in the directory tree;

[0320] When the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory to recycle the directory to be deleted.

[0321] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0322] According to one aspect of the present application, a computer program product is provided, the computer program product including a computer program / instruction, the computer program / instruction being stored in a computer-readable storage medium. A processor of an electronic device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the electronic device executes the method provided in various optional implementations of the directory recycling aspect provided in the above-mentioned embodiments.

[0323] Since the instructions stored in the storage medium can execute the steps in any directory recovery method provided in the embodiments of the present application, the beneficial effects that can be achieved by any directory recovery method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0324] The above is a detailed introduction to a directory recovery method, device, electronic device, storage medium and program product 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 of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A directory recycling method, characterized in that: include: Obtain a directory to be controlled in the directory tree, wherein the directory to be controlled is a directory other than the root directory in the directory tree; Creating a recycling directory at a level below the directory to be controlled, the recycling directory being used to recycle subdirectories under the directory to be controlled; Obtain the directory to be deleted from all directories in the directory tree; When the directory to be deleted is under the directory to be controlled, the directory to be deleted is moved to the recycling directory to recycle the directory to be deleted.

2. The directory recycling method according to claim 1, characterized in that: The directory to be controlled includes a plurality of sub-directories to be controlled, and the sub-directories to be controlled are sub-directories under the directory to be controlled. After creating a recycling directory at a level below the directory to be controlled, the method further includes: Obtaining the recycling keyword associated with the subdirectory to be controlled; Based on the recycling keyword, determining a subdirectory to be recycled from the multiple subdirectories to be controlled; Based on the sub-directory to be recycled, a recycling range of the recycling directory is determined, where the recycling range is a range within which the recycling directory recycles the sub-directories under the directory to be controlled.

3. The directory recycling method according to claim 1, characterized in that: After creating a recycling directory at the next level of the directory to be controlled, the method further includes: Acquire a to-be-published recycled directory in another directory tree, wherein the hierarchical structure of the other directory tree is the same as the hierarchical structure of the directory tree except for the to-be-published recycled directory, and the to-be-published recycled directory is a recycled directory created in the other directory tree; Based on the previous level of the to-be-published recycled directory, determine a target directory from all directories in the directory tree, the target directory being the same as the previous level of the to-be-published recycled directory; The to-be-published recycling directory is created at a level below the target directory, and the to-be-published recycling directory is used to recycle subdirectories under the target directory.

4. The directory recycling method according to claim 3, characterized in that: When the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes: Based on the directory to be deleted, determining a target recycling directory from the recycling directory to be published and the recycling directory, wherein the upper level of the target recycling directory includes the directory to be deleted; Move the directory to be deleted to the target recycling directory.

5. The directory recycling method according to claim 1, characterized in that: The step of obtaining the directory to be deleted from all directories in the directory tree includes: Get the interaction request sent by the client; Based on the interactive request, sending the recycling directory to the client; Obtaining a directory deletion command sent by the client to the recycling directory; Based on the directory deletion command, a directory to be deleted is determined in all directories in the directory tree.

6. The directory recycling method according to claim 5, characterized in that: The sending the recycling directory to the client based on the interactive request includes: Obtaining interaction time, where the interaction time is a time period for interacting with the client; When the interaction time is within a preset time period, the recycling directory is sent to the client.

7. The directory recycling method according to claim 1, characterized in that: When the directory to be deleted is under the directory to be controlled, moving the directory to be deleted to the recycling directory includes: When the directory to be deleted is under the directory to be controlled, renaming the directory to be deleted based on the recycling directory to move the directory to be deleted to the recycling directory; When the directory to be deleted is not under the directory to be controlled, the directory to be deleted is deleted in the directory tree.

8. The directory recycling method according to claim 7, characterized in that: When the directory to be deleted is under the directory to be controlled, renaming the directory to be deleted based on the recycled directory includes: When the directory to be deleted is under the directory to be controlled, determining a position to be inserted in the hierarchical structure of the directory to be deleted, the position to be inserted is located between the directory to be deleted and an upper level of the directory to be deleted; The recycling directory is inserted into the to-be-inserted position, so that the to-be-deleted directory belongs to the recycling directory.

9. The directory recycling method according to claim 1, characterized in that: When the directory to be deleted is in the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes: Obtaining a directory clearing instruction for the recycling directory; Based on the directory clearing instruction, determining a directory to be cleared from the recycling directory; Delete the directory to be cleared.

10. The directory recycling method according to claim 1, characterized in that: When the directory to be deleted is in the directory to be controlled, after moving the directory to be deleted to the recycling directory, the method further includes: Obtaining a directory restoration instruction for the recycling directory; Based on the directory restoration instruction, determine a directory to be restored from the subdirectories under the recycling directory; The directory to be restored is moved out from the recycling directory to reset the directory to be restored in the directory tree.

11. The directory recycling method according to claim 10, characterized in that: The step of removing the directory to be restored from the recycling directory includes: Based on the recycling directory, determining a level to be deleted from the hierarchical structure of the directory to be restored, the level to be deleted being the level at which the recycling directory is located; The to-be-deleted level in the to-be-restored directory is deleted to remove the to-be-restored directory from the recycling directory.

12. A directory recovery device, characterized in that: include: An acquisition unit, used for acquiring a directory to be controlled in a directory tree, wherein the directory to be controlled is a directory other than a root directory in the directory tree; A creating unit, used for creating a recycling directory at a level below the directory to be controlled, wherein the recycling directory is used for recycling subdirectories under the directory to be controlled; A deleting unit, used for obtaining a directory to be deleted from all directories in the directory tree; The recycling unit is used for moving the directory to be deleted to the recycling directory when the directory to be deleted is under the directory to be controlled, so as to recycle the directory to be deleted.

13. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the directory recycling method as claimed in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the directory recycling method according to any one of claims 1 to 11.

15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps in the directory recycling method described in any one of claims 1 to 11 are implemented.