File recovery method, system, device and electronic equipment

CN115408340BActive Publication Date: 2026-09-08BEIJING XSKY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211079286.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-05
Publication Date
2026-09-08
Estimated Expiration
2042-09-05

AI Technical Summary

Technical Problem

[0004]本申请的主要目的在于提供一种文件回收方法、系统、装置及电子设备,以解决相关技术中由于文件系统只有一个回收站,回收文件时不能灵活控制移入回收站和移出的规则,导致文件移入和移出回收站时效率低的问题

Benefits of technology

[0016] This application employs the following steps: Upon receiving a request to delete a file, the target directory of the file to be deleted in the file system is determined, and it is determined whether a target recycle bin exists in the target directory. The file system stores files and their directories; different directories have different recycle bins, and the target recycle bin is the recycle bin of the target directory. If a target recycle bin exists in the target directory, it is determined whether the target recycle bin is open. If the target recycle bin is open, it is determined whether the file to be deleted meets the recycling criteria. If the file to be deleted meets the recycling criteria, it is moved to the target recycle bin. This solves the problem in related technologies where, due to the file system having only one recycle bin, the rules for moving files into and out of the recycle bin cannot be flexibly controlled, resulting in low efficiency. By setting corresponding recycle bins for different directories and setting rules for moving files into and out of the recycle bin, the efficiency of moving files into and out of the recycle bin is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115408340B_ABST
    Figure CN115408340B_ABST
Patent Text Reader

Abstract

The application discloses a file recycling method, system and device and electronic equipment. The method comprises the following steps: in the case that a request of deleting a to-be-deleted file is received, determining a target directory of the to-be-deleted file in a file system, and judging whether a target recycle bin exists in the target directory; in the case that the target recycle bin exists in the target directory, judging whether the target recycle bin is in an open state; in the case that the target recycle bin is in the open state, judging whether the to-be-deleted file meets a recycling condition; and in the case that the to-be-deleted file meets the recycling condition, moving the to-be-deleted file to the target recycle bin. Through the application, the problem that the efficiency of moving files into and out of the recycle bin is low due to the fact that only one recycle bin exists in the file system and the rules of moving into and out of the recycle bin cannot be flexibly controlled when recycling files in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of document recycling, and more specifically, to a document recycling method, system, apparatus, and electronic device. Background Technology

[0002] In related technologies, files are reclaimed through a globally unique recycle bin in the file system. On the one hand, some globally unique recycle bins cannot have recycle bin admission rules set, while the admission rules for some recycle bins are relatively simple, only limiting the maximum capacity of the entire recycle bin. On the other hand, some globally unique recycle bins cannot have recycle bin exit rules set, while the exit rules for some recycle bins are relatively simple, only setting the maximum time a file can be retained in the recycle bin or permanently retaining files in the recycle bin.

[0003] There is currently no effective solution to the problem that in related technologies, the file system has only one recycle bin, which makes it impossible to flexibly control the rules for moving files into and out of the recycle bin, resulting in low efficiency when moving files into and out of the recycle bin. Summary of the Invention

[0004] The main objective of this application is to provide a file recycling method, system, device, and electronic device to solve the problem in related technologies where the file system has only one recycling bin, and the rules for moving files into and out of the recycling bin cannot be flexibly controlled, resulting in low efficiency when moving files into and out of the recycling bin.

[0005] To achieve the above objectives, according to one aspect of this application, a file recycling method is provided. The method includes: upon receiving a request to delete a file to be deleted, determining the target directory of the file to be deleted in a file system, and determining whether a target recycle bin exists in the target directory, wherein the file system is used to store files and the directories where the files are located, different directories have different recycle bins, and the target recycle bin is the recycle bin of the target directory; if a target recycle bin exists in the target directory, determining whether the target recycle bin is open; if the target recycle bin is open, determining whether the file to be deleted meets the recycling conditions; and if the file to be deleted meets the recycling conditions, moving the file to be deleted to the target recycle bin.

[0006] Optionally, before determining whether a target recycle bin exists in the target directory, the method further includes: receiving a deletion request for a file to be deleted; if the deletion request indicates that the file to be deleted be placed in the trash bin, moving the file to be deleted to the trash bin, wherein files in the trash bin cannot be recovered; and if the deletion request indicates that the file to be deleted be placed in the recycle bin, moving the file to be deleted to the target recycle bin.

[0007] Optionally, moving the files to be deleted to the target recycle bin includes: creating a recycle bin directory in the target recycle bin based on the target directory, and moving the files to be deleted to the recycle bin directory.

[0008] Optionally, if the target directory has not been deleted, after moving the file to be deleted to the target recycle bin, the method further includes: if a recycle operation is detected that has the same name as the file to be deleted, obtaining the target string of the file to be deleted, wherein the recycle operation refers to the operation of moving the file with the same name to the target recycle bin, and the target string includes the deletion time and version number of the file to be deleted; appending the target string to the original filename of the file to be deleted to obtain the renamed filename of the file to be deleted, and moving the file with the same name to the target recycle bin.

[0009] Optionally, determining whether a file to be deleted meets the recycling criteria includes: determining whether the space occupied by the file to be deleted is less than or equal to a space threshold; if the space occupied by the file to be deleted is less than or equal to the space threshold, determining whether the type of the file to be deleted is a preset type; if the type of the file to be deleted is not a preset type, determining whether the suffix of the file to be deleted is a preset suffix; if the suffix of the file to be deleted is not a preset suffix, determining whether the remaining storage space of the target recycle bin is greater than or equal to the occupied space; if the remaining storage space of the target recycle bin is greater than or equal to the occupied space, determining that the file to be deleted meets the recycling criteria.

[0010] Optionally, after moving the files to be deleted to the target recycle bin, the method further includes: determining whether the target recycle bin has periodic deletion enabled; if the target recycle bin has periodic deletion enabled, obtaining the deletion period of the target recycle bin and determining the archiving period based on the deletion period, wherein the archiving period is less than or equal to the deletion period; determining whether there are files in the target recycle bin according to the archiving period; if there are files in the target recycle bin, moving all files in the target recycle bin that are not in the archive directory to the current archive directory, wherein the target recycle bin contains archive directories, and different archive directories store files from different recycling time intervals.

[0011] Optionally, after moving all files in the target recycle bin that are not in the archive directory to the current archive directory, the method further includes: determining whether the duration between the creation time of each archive directory and the current time is greater than or equal to the deletion period; if the duration is greater than or equal to the deletion period, deleting the files in the archive directory from the target recycle bin.

[0012] Optionally, after moving the file to be deleted to the target recycle bin, the method further includes: obtaining the user's file retrieval request and parsing the file retrieval request to obtain file filtering conditions, wherein the file retrieval request is used to retrieve the target retrieval file needed by the user in the target recycle bin; traversing all files in the target recycle bin, determining in turn whether each file meets the file filtering conditions, and identifying the file that meets the file filtering conditions as the target retrieval file.

[0013] Optionally, after determining the target directory of the file to be deleted in the file system, the method further includes: upon receiving a request to delete the target directory, determining whether the parent directory of the target directory has a recycle bin; if the parent directory does not have a recycle bin, moving the target directory to a proxy recycle bin; if the parent directory has a recycle bin, determining whether the parent directory's recycle bin is enabled; if the parent directory's recycle bin is not enabled, moving the target directory to a proxy recycle bin; if the parent directory has a recycle bin and it is enabled, determining whether the remaining space capacity of the parent directory's recycle bin is greater than or equal to the space occupied by the target directory; if the remaining space capacity of the parent directory's recycle bin is less than the space occupied by the target directory, moving the target directory to a proxy recycle bin; if the remaining space capacity of the parent directory's recycle bin is greater than or equal to the space occupied by the target directory, determining whether the target directory meets the recycling conditions for entering the parent directory's recycle bin; if the target directory does not meet the recycling conditions, moving the target directory to a proxy recycle bin; if the target directory meets the recycling conditions, moving the target directory to the parent directory's recycle bin.

[0014] To achieve the above objectives, according to another aspect of this application, a file recycling system is provided. The system includes: a file system for storing multiple files and the directory where each file is located; a scheduling module for moving files from the file system to a recycle bin or a junk bin based on file deletion requests; a junk bin for storing files moved to the junk bin; and a recycle bin cluster including multiple recycle bins, each recycle bin corresponding to a file directory, and each recycle bin storing files moved from its corresponding file directory to the recycle bin.

[0015] To achieve the above objectives, according to another aspect of this application, a file recycling apparatus is provided. The apparatus includes: a determining unit, configured to, upon receiving a request to delete a file, determine the target directory of the file to be deleted in a file system and determine whether a target recycle bin exists in the target directory, wherein the file system is used to store files and the directories where the files are located, different directories have different recycle bins, and the target recycle bin is the recycle bin of the target directory; a first determining unit, configured to, if a target recycle bin exists in the target directory, determine whether the target recycle bin is in an open state; a second determining unit, configured to, if the target recycle bin is in an open state, determine whether the file to be deleted meets the recycling conditions; and a moving unit, configured to, if the file to be deleted meets the recycling conditions, move the file to be deleted to the target recycle bin.

[0016] This application employs the following steps: Upon receiving a request to delete a file, the target directory of the file to be deleted in the file system is determined, and it is determined whether a target recycle bin exists in the target directory. The file system stores files and their directories; different directories have different recycle bins, and the target recycle bin is the recycle bin of the target directory. If a target recycle bin exists in the target directory, it is determined whether the target recycle bin is open. If the target recycle bin is open, it is determined whether the file to be deleted meets the recycling criteria. If the file to be deleted meets the recycling criteria, it is moved to the target recycle bin. This solves the problem in related technologies where, due to the file system having only one recycle bin, the rules for moving files into and out of the recycle bin cannot be flexibly controlled, resulting in low efficiency. By setting corresponding recycle bins for different directories and setting rules for moving files into and out of the recycle bin, the efficiency of moving files into and out of the recycle bin is improved. Attached Figure Description

[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0018] Figure 1 This is a flowchart of a file recycling method provided according to an embodiment of this application;

[0019] Figure 2 This is a schematic diagram of the directory structure within the recycle bin according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of the structure of a file recycling system provided according to an embodiment of this application;

[0021] Figure 4This is a schematic diagram of a file recycling device provided according to an embodiment of this application. Detailed Implementation

[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0026] Recycle Bin: After a file or directory is deleted, it is retained in a specific directory structure for subsequent possible file and directory recovery, deletion, emptying, and other actions.

[0027] Directory structure: The way the file system presents files to the outside world, in a tree-like structure.

[0028] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a file recycling method provided according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0029] Step S101: Upon receiving a request to delete a file to be deleted, determine the target directory of the file to be deleted in the file system and determine whether the target directory has a target recycle bin. The file system is used to store files and the directories where the files are located. Different directories have different recycle bins. The target recycle bin is the recycle bin of the target directory.

[0030] Specifically, the file to be deleted refers to the file that the user indicates to be deleted from the file system in the file deletion request. The file system stores all files on the computer and the directory where each file is located. The target directory is the storage location and path of the file to be deleted within the file system. The target recycle bin is the recycle bin configured on the target directory. Upon receiving a file deletion request, the system confirms the file to be deleted and the target directory in the file deletion request and checks whether a recycle bin is configured in the target directory.

[0031] It should be noted that file system users often use a directory for a specific purpose, and files deleted from this directory and its subdirectories are expected to go to the corresponding recycle bin. This application allows setting a recycle bin for any directory. This moves files to be deleted from different directories to the corresponding recycle bin, making it easier for users to find files in the recycle bin quickly and preparing them for later removal, thus improving the efficiency of moving files into and out of the recycle bin.

[0032] Step S102: If a target recycle bin exists in the target directory, determine whether the target recycle bin is in an open state.

[0033] Specifically, the recycle bin for each directory can be dynamically controlled to be on or off. When the target directory corresponding to the file to be deleted is configured with a target recycle bin, it is also necessary to check whether the target recycle bin is set to an on state. Only when the target recycle bin is set to an on state can the file to be deleted be moved to the target recycle bin. If the target recycle bin is set to a off state, the file to be deleted will be moved directly to the trash can and will not be moved to the recycle bin.

[0034] Step S103: If the target recycle bin is open, determine whether the file to be deleted meets the recycling conditions.

[0035] Specifically, the recycle conditions, also known as the admission criteria for the target recycle bin, can be dynamically set for different recycle bins. Admission conditions include at least the space occupied, file type, file extension, and recycle bin capacity. This allows for efficient recycle bin management and prevents file system malfunctions caused by directly moving files to the recycle bin without setting admission conditions.

[0036] Step S104: If the file to be deleted meets the recycling conditions, move the file to be deleted to the target recycle bin.

[0037] Specifically, the recycling conditions can include multiple conditions. When a file to be deleted meets all the recycling conditions of the target recycle bin, the file to be deleted will be moved to the target recycle bin.

[0038] The file recycling method provided in this application, upon receiving a request to delete a file, determines the target directory of the file to be deleted in the file system and checks whether a target recycle bin exists in the target directory. The file system stores files and their directories; different directories have different recycle bins, and the target recycle bin is the recycle bin of the target directory. If a target recycle bin exists in the target directory, it checks whether the target recycle bin is open. If the target recycle bin is open, it checks whether the file to be deleted meets the recycling conditions. If the file meets the recycling conditions, it moves the file to the target recycle bin. This solves the problem in related technologies where, due to the file system having only one recycle bin, the rules for moving files into and out of the recycle bin cannot be flexibly controlled, resulting in low efficiency. By setting corresponding recycle bins for different directories and setting rules for moving files into and out of the recycle bin, the efficiency of moving files into and out of the recycle bin is improved.

[0039] Since some directories in the file system do not have a recycle bin, when deleting files in directories without a recycle bin, the files to be deleted need to be moved to the trash bin. Optionally, in the file recycling method provided in this application embodiment, before determining whether a target recycle bin exists in the target directory, the method further includes: receiving a deletion request for a file to be deleted; if the deletion request indicates that the file to be deleted be placed in the trash bin, moving the file to be deleted to the trash bin, wherein files in the trash bin cannot be recovered; and if the deletion request indicates that the file to be deleted be placed in the recycle bin, moving the file to be deleted to the target recycle bin.

[0040] Specifically, a deletion request refers to a user's instruction to delete a file in the file system. The garbage bin, also known as the garbage collection space, stores all records within this space according to preset storage rules. The files corresponding to these records have been deleted and cannot be recovered; the purpose of these records is to release the disk space occupied by the data portion of the corresponding files later. The recycle bin, also known as the recycle space, stores all directories and files within this space according to preset storage rules. Directories and files in the recycle bin can be recovered or permanently deleted later. Users can issue corresponding deletion requests based on different needs, instructing the files to be deleted to be moved to the garbage bin or recycle bin. By instructing users to move files to be deleted to the corresponding recycle bin or garbage bin through deletion requests, file recycling can be controlled flexibly and efficiently.

[0041] It should be noted that if a deletion request instructs the file to be moved to the recycle bin when no recycle bin is set in the directory, the file to be deleted will be moved directly to the junk bin if the directory does not have a recycle bin.

[0042] When moving a file to be deleted to the recycle bin, a path for storing the file to be deleted needs to be created in the recycle bin. Optionally, in the file recycling method provided in this application embodiment, moving a file to be deleted to the target recycle bin includes: creating a recycle bin directory in the target recycle bin according to the target directory, and moving the file to be deleted to the recycle bin directory.

[0043] Specifically, the target directory refers to the initial path in the file system where the file to be deleted is stored, and the recycle bin directory refers to the storage path of the file to be deleted within the recycle bin after it has been moved there. When a user instructs the deletion of a file, the directory containing that file may also be deleted. Therefore, after deleting a file, it's necessary to check if the target directory has also been deleted. If the target directory hasn't been deleted, since there's no path to store the file to be deleted within the target recycle bin, a recycle bin directory needs to be created within the target recycle bin, mirroring the target directory, to serve as the path for storing the file to be deleted. If the target directory is deleted, since the recycle bin directory was already created when the file to be deleted was deleted, and the recycle bin directory shares the same storage path as the target directory within the recycle bin, there's no need to create a new path for the target directory within the target recycle bin. In other words, the target directory is directly deleted from the file system.

[0044] It should be noted that if you need to delete an empty directory, and there are no files with the same name as the empty directory in the recycle bin, create the path to the empty directory in the recycle bin and move the empty directory into the recycle bin. If there are files with the same name as the empty directory in the recycle bin, delete the empty directory from the file system.

[0045] For example, if a recycle bin is configured in the ` / root` directory, and the file `file` is stored in the ` / root` directory according to the target directory ` / root / A / B / file`, then if the target directory is not deleted, the following directory and file ` / root / .trash / current / A / B / file` will be created in the recycle bin directory. The `uid` (user ID), `gid` (group ID), and `mode` (status) of directories A and B in the recycle bin will be the same as those in the target directories A and B. If the ` / root / A / B` directory itself is also deleted, then according to the tree rule, a directory with the same name as B needs to be created in the `.trash` directory. However, since the ` / root / .trash / current / A / B` directory has already been created to store `file`, when ` / root / A / B` is deleted, directory B will not be moved to the recycle bin.

[0046] When deleting a file, there is a possibility that a file with the same name as the file in the recycle bin may also be moved to the recycle bin. Optionally, in the file recycling method provided in this application embodiment, if the target directory has not been deleted, after moving the file to be deleted to the target recycle bin, the method further includes: if a recycling operation is detected that has the same name as the file to be deleted, obtaining the target string of the file to be deleted, wherein the recycling operation refers to the operation of moving the file with the same name to the target recycle bin, and the target string includes the deletion time and version number of the file to be deleted; adding the target string to the original file name of the file to be deleted to obtain the renamed file name of the file to be deleted, and moving the file with the same name to the target recycle bin.

[0047] For example, if a file named `file` is deleted and then recreated in the ` / root / A / B / ` directory of the file system, and then simultaneously deleted again, since the recycle bin directory has already been created in the `current` directory within the recycle bin, there's no need to recreate the directory for `file` in the target recycle bin. However, since a file named `file` already exists in the target recycle bin, the initial file `file` in the target recycle bin needs to be renamed to `file.xxx`, where `xxx` is a globally unique string, i.e., the target string. Finally, the file with the same name `file` is moved into the recycle bin, becoming ` / root / .trash / current / A / B / file`. If a file to be moved into the recycle bin has the same name as a directory within the recycle bin, then the file to be moved into the recycle bin is renamed.

[0048] It's important to note that the target string consists of two parts. The first part is the operation time, accurate to the second. For example, 2022-08-13.20-21-05 refers to the renaming operation performed at 20:21:05 on August 13, 2022. The second part is a globally unique version number of the file or directory being operated on. For example, 100012 is the version number of the renaming operation. Therefore, the final form of the target string xxx is 2022-08-13.20-21-05.100012, which theoretically ensures global uniqueness while also clearly indicating the creation time of the renamed file or archive directory.

[0049] When reclaiming files to be deleted, admission criteria for the target recycle bin can also be set. Optionally, in the file reclamation method provided in this application embodiment, determining whether a file to be deleted meets the reclamation criteria includes: determining whether the space occupied by the file to be deleted is less than or equal to a space threshold; if the space occupied by the file to be deleted is less than or equal to the space threshold, determining whether the type of the file to be deleted is a preset type; if the type of the file to be deleted is not a preset type, determining whether the suffix of the file to be deleted is a preset suffix; if the suffix of the file to be deleted is not a preset suffix, determining whether the remaining storage space of the target recycle bin is greater than or equal to the occupied space; if the remaining storage space of the target recycle bin is greater than or equal to the occupied space, determining that the file to be deleted meets the reclamation criteria.

[0050] Specifically, `max-filesize` refers to the maximum file size that can be sent to the recycle bin, measured in bytes. Files exceeding this maximum size are not allowed in the recycle bin. Not setting `max-filesize` means there are no restrictions on which files can be sent. `blacklist-type` specifies which file types cannot be sent to the recycle bin. Multiple file types can be specified, separated by commas. Not setting `blacklist-type` means there are no restrictions on which files can be sent. Commonly supported file types in the recycle bin include: `regfile` (regular file), `dir` (directory), `symlink` (symlink), `hardlink` (hard link), `chardev` (character device), `blockdev` (block device), `fifo` (pipe file), and `socket` (socket file).

[0051] The file extension, or blacklist-suffix, is used to prevent files with specific extensions from being sent to the recycle bin. Multiple extensions can be specified, separated by commas. Not setting a blacklist-suffix means there are no restrictions on files going to the recycle bin. For example, files with the extensions .exe and .tmp will not be sent to the recycle bin. The recycle bin capacity, or max-spacesize, refers to the total storage space allowed in the recycle bin, measured in MiB. Setting max-spacesize to 0 means there are no restrictions on files going to the recycle bin.

[0052] Before moving each file to the recycle bin, it's necessary to check if the recycle bin's entry criteria are met. For example, if directory X has three entry criteria: available space, file type, and recycle bin capacity, but no file extension is specified, moving file 'a' to the recycle bin in directory X requires checking if file 'a' exceeds the maximum available space set for the recycle bin in directory X. For instance, if file 'a' is 512 bytes and the maximum available space for the recycle bin in directory X is 1024 bytes, then file 'a' is smaller than the available space, meaning file 'a' meets the first criterion for entering the recycle bin. If the recycle bin prohibits piped files, and file 'a' is a piped file, then file 'a' does not meet the second criterion and cannot be moved to the recycle bin. If file 'a' is not a piped file, it's also necessary to check if the remaining storage capacity of the recycle bin is greater than 512 bytes. If it is, then file 'a' meets the recycle bin's entry criteria and can be moved to the recycle bin. By flexibly setting the entry criteria for the recycle bin in each directory, file management and recycling can be achieved efficiently.

[0053] When deleting files from the recycle bin, exit rules can also be set. Optionally, in the file recycling method provided in this application embodiment, after moving the file to be deleted to the target recycle bin, the method further includes: determining whether the target recycle bin has the periodic deletion function enabled; if the target recycle bin has the periodic deletion function enabled, obtaining the deletion period of the target recycle bin and determining the archiving period based on the deletion period, wherein the archiving period is less than or equal to the deletion period; determining whether there are files in the target recycle bin according to the archiving period; if there are files in the target recycle bin, moving all files in the target recycle bin that are not in the archiving directory to the current archiving directory, wherein the target recycle bin contains an archiving directory, and different archiving directories store files from different recycling time intervals.

[0054] Specifically, the deletion cycle is a time interval set within the recycle bin to automatically delete all files in archive directories that have exceeded the deletion cycle at regular intervals. The archive cycle is the period during which files deleted from the recycle bin that have been inactive for a longer period are moved to the same folder. When there are many files in the recycle bin, it can be difficult to distinguish between them due to the large number of files that need to be recovered or emptied; therefore, an archive cycle is set. For example, if the deletion cycle for the recycle bin under directory X is eight months, the archive cycle can be set to 1 / 8 of the deletion cycle, i.e., one month. Every month, all files in the recycle bin are moved to an archive directory. An archive directory is created in the recycle bin every month, and all files in the archive directory with a lifespan greater than or equal to the deletion cycle are deleted, and the archive directory itself is also deleted. The lifespan refers to the period between the creation time of the archive directory and the current time. By setting an archive directory, files that need to be deleted periodically are stored in one directory, avoiding the need to check each file individually to see if its deletion cycle has expired before moving it into the recycle bin. Instead, only the creation time of the archive directory needs to be checked to see if the deletion cycle has expired, thus improving the efficiency of processing files in the recycle bin.

[0055] It should be noted that all files moved into the recycle bin are initially stored in the current directory. Every archiving cycle, files in the current directory are moved to the archive directory, i.e., the archive.xxx directory. Figure 2 This is a schematic diagram of the directory structure within the recycle bin according to an embodiment of this application, such as... Figure 2 As shown, the .trash (recycle bin) contains two types of directories: one is the current directory, where each new file moved into the recycle bin is stored; the other is the archive directory, such as archive.yyy and archive.zzz.

[0056] After establishing the archive directory, the files in the archive directory are cleared by comparing the creation time of the archive directory with the deletion cycle. Optionally, in the file recycling method provided in this application embodiment, after moving all files in the target recycle bin that are not in the archive directory to the current archive directory, the method further includes: determining whether the time between the creation time of each archive directory and the current time is greater than or equal to the deletion cycle; if the time is greater than or equal to the deletion cycle, deleting the files in the archive directory from the target recycle bin.

[0057] Specifically, to avoid accidentally deleting recoverable files during bulk emptying of the recycle bin, the emptying operation can be set to empty files in archive directories. Every archive cycle, the system checks if the time between the creation time and the current time of all archive directories in the recycle bin is greater than or equal to the deletion cycle. If the time between the creation time and the current time of an archive directory is greater than or equal to the deletion cycle, the archive directory will be emptied. For example, if archive.yyy was created 9 months ago, exceeding the deletion cycle by 8 months, then all files in the archive.yyy directory will be emptied. By periodically emptying files in archive directories whose creation time exceeds the deletion cycle, storage space in the recycle bin can be effectively saved.

[0058] After moving the files to be deleted to the target recycle bin, the target recycle bin also provides a file retrieval function. Optionally, in the file recycling method provided in this application embodiment, after moving the files to be deleted to the target recycle bin, the method further includes: obtaining the user's file retrieval request and parsing the file retrieval request to obtain file filtering conditions, wherein the file retrieval request is used to retrieve the target retrieval file needed by the user in the target recycle bin; traversing all files in the target recycle bin, sequentially determining whether each file meets the file filtering conditions, and determining the file that meets the file filtering conditions as the target retrieval file.

[0059] Specifically, a file retrieval request refers to a user's request to search for files moved to the target recycle bin. File filtering criteria are conditions set by the user based on the search functions provided by the target recycle bin. The search functions provided by the target recycle bin include: `max` (maximum number of files to list; if `max` is not set, a maximum of 500 directory entries will be listed); `prefix` (directory entry name prefix; only directory entries matching this prefix will be listed); `filter` (file, dir; listing only regular files or only directories; if no filter is set, all directories will be listed); `show-hidden` (showing hidden directory entries, i.e., those starting with the character "."); `show-original-name` (listing the original filename of renamed files); and `marker` (the starting file for traversal; this setting can be used to list files when there are many files in the recycle bin. The format of `marker` is, for example, entry directory name (archive or current) / entry directory fileid / last listed directory entry name. The search also finds the paths of all deleted files in the target recycle bin. Files are listed in ascending order of their placement in the target recycle bin. Within the same archive or current directory, files are listed in ascending order of their ASCII names. The target file is then selected from the list based on specific file filtering criteria. This search function within the target recycle bin allows users to quickly find files that need to be recovered or deleted.

[0060] For example, if the ` / root` directory is configured with a recycle bin, and in chronological order, the ` / root / A / B` directories have previously deleted files such as `file.too.old`, `file.old`, two files with the same name `file`, `file2`, and an empty `dir` directory, this search function provides the ability to search for files and directories in the ` / root / A / B` directories that were previously deleted but are still in the recycle bin (i.e., not automatically deleted before expiration). In this case, because `file.too.old` was deleted too long ago, it has already been automatically expired and deleted by the recycle bin, so it cannot be found. `file.old` is archived in the `~archive.xxx` directory and is searched first according to the rules. The remaining files and directories are still in the `current` directory and are listed according to the rules, sorted by ASCII code value from smallest to largest. The `dir` directory is listed first (even if `dir` is not empty, directory entries within `dir` will not be listed), then `file`, `file.yyy`, and finally `file2` (because the ASCII code value of the number 2 is greater than the ASCII code value of the character `.`).

[0061] In addition to moving files to be deleted to the target recycle bin, there are also cases where directories are moved to the target recycle bin. Optionally, in the file recycling method provided in this application embodiment, after determining the target directory of the file to be deleted in the file system, the method further includes: upon receiving a request to delete the target directory, determining whether the parent directory of the target directory has a recycle bin; if the parent directory does not have a recycle bin, moving the target directory to a proxy recycle bin; if the parent directory has a recycle bin, determining whether the parent directory's recycle bin is enabled; if the parent directory's recycle bin is not enabled, moving the target directory to a proxy recycle bin; if the parent directory has a recycle bin, determining whether the parent directory's recycle bin is enabled; if the parent directory has a recycle bin, moving the target directory to a proxy recycle bin; if the parent directory has a recycle bin, moving the target directory to a proxy recycle bin. If the recycle bin in the parent directory is enabled, check if the remaining space in the parent directory's recycle bin is greater than or equal to the space occupied by the target directory. If the remaining space in the parent directory's recycle bin is less than the space occupied by the target directory, move the target directory to the proxy recycle bin. If the remaining space in the parent directory's recycle bin is greater than or equal to the space occupied by the target directory, check if the target directory meets the conditions for entering the parent directory's recycle bin. If the target directory does not meet the conditions for entering the recycle bin, move the target directory to the proxy recycle bin. If the target directory meets the conditions for entering the recycle bin, move the target directory to the parent directory's recycle bin.

[0062] Specifically, the parent directory refers to the path in the file system where the target directory is stored. The proxy recycle bin is the only recycle bin in the file system, used to store the target directory when it has too many files to be moved into the parent directory's recycle bin. Since the target directory's parent directory may not have a recycle bin, or if the parent directory's recycle bin exists, it may not be available, or if the parent directory's recycle bin is available, the remaining space may not be enough to hold the target directory, or the parent directory's recycle bin may be set to prevent the target directory from being recycled. In these situations, deleting the target directory requires deleting each file in the target directory, which is inefficient. Therefore, a proxy recycle bin is provided. When the above situations occur, the target directory is moved to this globally unique proxy recycle bin. Providing a proxy recycle bin makes moving directories into the recycle bin more efficient.

[0063] It's important to note that the proxy recycle bin only allows access from users with specific permissions (such as administrators), but does not allow them to perform operations like deletion or restoration, which are possible in a regular recycle bin. The proxy recycle bin's role is simply to act as a container for deleted directories. The file system's scanning thread traverses the proxy recycle bin. If a directory exists in the proxy recycle bin, the request is distributed and persisted across different median files (MDSs) in the same way as a delete request in a regular recycle bin. Then, the deletion thread is notified to traverse the directory and perform the actual deletion.

[0064] To achieve the above objectives, according to another aspect of this application, a file recycling system is provided. Figure 3This is a schematic diagram of a file recycling system provided according to an embodiment of this application. The system includes:

[0065] File system 31 is used to store multiple files and the directory where each file is located;

[0066] Specifically, file system 31 is a system for storing all of the user's files. The user can move files in or out of the recycle bin as needed.

[0067] Scheduling module 32 is used to move files in file system 31 to recycle bin or trash bin 33 according to file deletion requests;

[0068] Specifically, when a user needs to move file A to the recycle bin, they issue a deletion request. The scheduling module 32 then moves file A stored in the file system 31 to the recycle bin cluster 34 or the trash bin 33 based on the deletion request.

[0069] Garbage station 33 is used to store files that have been moved to garbage station 33;

[0070] Specifically, if the file to be deleted by the user in the deletion request does not meet the admission criteria for moving to the recycle bin, the file to be deleted will be moved to the trash bin 33. Alternatively, if the directory where the file to be deleted is stored in the file system 31 does not have a recycle bin or the recycle bin is not enabled, the file to be deleted will be moved to the trash bin 33.

[0071] The recycle bin cluster 34 includes multiple recycle bins, each corresponding to a file directory, and each recycle bin is used to store files moved from the corresponding file directory to the recycle bin.

[0072] Specifically, the recycle bin cluster 34 contains multiple recycle bins, each recycle bin corresponds to a directory in the file system 31, and each recycle bin is responsible for storing the deleted files in the corresponding directory of the recycle bin.

[0073] The file recycling system provided in this application embodiment allows the scheduling module 32 to move files to be deleted stored in the file system 31 to the trash bin 33 or the recycling bin under the corresponding directory, based on the user's deletion request or the recycling bin's admission and exit rules. This enables flexible control over the admission and exit rules of the recycling bin for each directory, improving the efficiency of moving files into and out of the recycling bin.

[0074] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0075] This application also provides a file recycling device. It should be noted that the file recycling device of this application can be used to execute the file recycling method provided in this application. The file recycling device provided in this application is described below.

[0076] Figure 4 This is a schematic diagram of a file recycling device provided according to an embodiment of this application. Figure 4 As shown, the device includes:

[0077] The determining unit 10 is used to determine the target directory of the file to be deleted in the file system when a request to delete the file to be deleted is received, and to determine whether there is a target recycle bin in the target directory. The file system is used to store files and the directories where the files are located. Different directories have different recycle bins. The target recycle bin is the recycle bin of the target directory.

[0078] The first judgment unit 20 is used to determine whether the target recycle bin is in an open state when the target directory has a target recycle bin.

[0079] The second judgment unit 30 is used to determine whether the file to be deleted meets the recycling conditions when the target recycle bin is open.

[0080] The moving unit 40 is used to move the file to be deleted to the target recycle bin if the file meets the recycling conditions.

[0081] The file recycling device provided in this application embodiment, through a determining unit, determines the target directory of the file to be deleted in the file system when a request to delete a file to be deleted is received, and determines whether a target recycle bin exists in the target directory. The file system is used to store files and the directories where the files are located. Different directories have different recycle bins, and the target recycle bin is the recycle bin of the target directory. A first determining unit determines whether the target recycle bin is open if it exists in the target directory. A second determining unit determines whether the file to be deleted meets the recycling conditions if the target recycle bin is open. A moving unit moves the file to be deleted to the target recycle bin if it meets the recycling conditions. This solves the problem in related technologies where, because the file system has only one recycle bin, the rules for moving files into and out of the recycle bin cannot be flexibly controlled, resulting in low efficiency. By setting corresponding recycle bins for different directories and setting rules for moving files into and out of the recycle bin, the efficiency of moving files into and out of the recycle bin is improved.

[0082] Optionally, in the file recycling device provided in this application embodiment, the device further includes: a first acquisition unit, configured to receive a deletion request for a file to be deleted; a garbage moving unit, configured to move the file to be deleted to a garbage bin when the deletion request indicates that the file to be deleted be placed in a garbage bin, wherein the file in the garbage bin cannot be recovered; and an execution unit, configured to move the file to be deleted to the target garbage bin when the deletion request indicates that the file to be deleted be placed in a recycling bin.

[0083] Optionally, in the file recycling device provided in this application embodiment, the moving unit 40 includes: a creation module, used to create a recycle bin directory in the target recycle bin according to the target directory if the target directory has not been deleted, and move the files to be deleted to the recycle bin directory.

[0084] Optionally, in the file recycling apparatus provided in this application embodiment, the apparatus further includes: a second acquisition unit, configured to acquire a target string of the file to be deleted when a recycling operation of a file with the same name as the file to be deleted is detected, wherein the recycling operation refers to the operation of moving the file with the same name to a target recycle bin, and the target string includes the deletion time and version number of the file to be deleted; and an addition unit, configured to add the target string to the original file name of the file to be deleted to obtain the renamed file name of the file to be deleted, and move the file with the same name to the target recycle bin.

[0085] Optionally, in the file recycling device provided in this application embodiment, the second judgment unit 30 includes: a first judgment module, used to judge whether the space occupied by the file to be deleted is less than or equal to a space threshold; a second judgment module, used to judge whether the type of the file to be deleted is a preset type when the space occupied by the file to be deleted is less than or equal to the space threshold; a third judgment module, used to judge whether the suffix of the file to be deleted is a preset suffix when the type of the file to be deleted is not a preset type; a fourth judgment module, used to judge whether the remaining storage space of the target recycle bin is greater than or equal to the occupied space when the suffix of the file to be deleted is not a preset suffix; and a determination module, used to determine that the file to be deleted meets the recycling conditions when the remaining storage space of the target recycle bin is greater than or equal to the occupied space.

[0086] Optionally, in the file recycling device provided in this application embodiment, the device further includes: a third judgment unit, used to judge whether the periodic deletion function of the target recycle bin is enabled; a third acquisition unit, used to acquire the deletion cycle of the target recycle bin when the periodic deletion function of the target recycle bin is enabled, and determine the archiving cycle based on the deletion cycle, wherein the archiving cycle is less than or equal to the deletion cycle; a fourth judgment unit, used to judge whether there are files in the target recycle bin according to the archiving cycle; and an archive directory moving unit, used to move all files in the target recycle bin that are not in the archive directory to the current archive directory when there are files in the target recycle bin, wherein the target recycle bin contains an archive directory, and different archive directories store files from different recycling time intervals.

[0087] Optionally, in the file recycling device provided in this application embodiment, the device further includes: a fifth judgment unit, used to judge whether the duration between the creation time of each archive directory and the current time is greater than or equal to the deletion period; and a deletion unit, used to delete the files in the archive directory from the target recycle bin if the duration is greater than or equal to the deletion period.

[0088] Optionally, in the file recycling device provided in this application embodiment, the device further includes: a retrieval unit, used to acquire a user's file retrieval request and parse the file retrieval request to obtain file filtering conditions, wherein the file retrieval request is used to retrieve the target retrieval file needed by the user in the target recycle bin; and a traversal unit, used to traverse all files in the target recycle bin, sequentially determine whether each file meets the file filtering conditions, and determine the file that meets the file filtering conditions as the target retrieval file.

[0089] Optionally, in the file recycling device provided in this application embodiment, the device further includes: a sixth determining unit, configured to determine whether a recycle bin exists in the parent directory of the target directory when a request to delete the target directory is received; if the parent directory does not have a recycle bin, move the target directory to a proxy recycle bin; a first moving-in unit, configured to determine whether the recycle bin of the parent directory is enabled when the parent directory has a recycle bin; if the parent directory's recycle bin is not enabled, move the target directory to a proxy recycle bin; a seventh determining unit, configured to determine whether the remaining space capacity of the parent directory's recycle bin is greater than or equal to the occupied space of the target directory when the parent directory has a recycle bin and the parent directory's recycle bin is enabled; if the remaining space capacity of the parent directory's recycle bin is less than the occupied space of the target directory, move the target directory to a proxy recycle bin; an eighth determining unit, configured to determine whether the target directory meets the recycling conditions for entering the parent directory's recycle bin when the remaining space capacity of the parent directory's recycle bin is greater than or equal to the occupied space of the target directory; if the target directory does not meet the recycling conditions, move the target directory to a proxy recycle bin; and a second moving-in unit, configured to move the target directory to the parent directory's recycle bin when the target directory meets the recycling conditions.

[0090] The file recycling device includes a processor and a memory. The aforementioned determining unit 10, first judging unit 20, second judging unit 30, and moving unit 40 are all stored in the memory as program units. The processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0091] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the efficiency of moving files into and out of the recycle bin.

[0092] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0093] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements a file recycling method.

[0094] This invention provides a processor for running a program, wherein the program executes a file recycling method during runtime.

[0095] This invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements a file recycling method. The device described herein can be a server, PC, tablet, mobile phone, etc.

[0096] This application also provides a computer program product that, when executed on a data processing device, is suitable for executing a program with the following initialization method steps: a file recycling method.

[0097] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0098] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0099] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0100] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0101] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0102] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0103] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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 technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0104] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0105] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0106] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A file recycling method, characterized in that, include: Upon receiving a request to delete a file to be deleted, the target directory of the file to be deleted in the file system is determined, and it is determined whether the target directory has a target recycle bin. The file system is used to store files and the directories where the files are located. Different directories have different recycle bins. The target recycle bin is the recycle bin of the target directory. If the target recycle bin exists in the target directory, determine whether the target recycle bin is in an open state. The recycle bin for each directory can be dynamically controlled to be opened or closed. When the target recycle bin is in the open state, it is determined whether the file to be deleted meets the recycling conditions. The recycling conditions are the admission conditions of the target recycle bin. Different admission conditions are dynamically set for different recycle bins. The admission conditions include at least the space occupied, file type, file extension and recycle bin capacity. If the file to be deleted meets the recycling conditions, the file to be deleted will be moved to the target recycle bin; After determining the target directory of the file to be deleted in the file system, the method further includes: upon receiving a request to delete the target directory, determining whether the parent directory of the target directory has a recycle bin; if the parent directory does not have a recycle bin, moving the target directory to a proxy recycle bin; if the parent directory has a recycle bin, determining whether the parent directory's recycle bin is enabled; if the parent directory's recycle bin is not enabled, moving the target directory to the proxy recycle bin; if the parent directory has a recycle bin and the parent directory's recycle bin is enabled, determining whether the remaining space capacity of the parent directory's recycle bin is greater than or equal to the occupied space of the target directory; if the remaining space capacity of the parent directory's recycle bin is less than the occupied space of the target directory, moving the target directory to the proxy recycle bin; if the remaining space capacity of the parent directory's recycle bin is greater than or equal to the occupied space of the target directory, determining whether the target directory meets the recycling conditions for entering the parent directory's recycle bin; if the target directory does not meet the recycling conditions, moving the target directory to the proxy recycle bin; if the target directory meets the recycling conditions, moving the target directory to the parent directory's recycle bin. Moving the file to be deleted to the target recycle bin includes: Create a recycle bin directory in the target recycle bin according to the target directory, and move the files to be deleted to the recycle bin directory; If the target directory has not been deleted, after moving the file to be deleted to the target recycle bin, the method further includes: If a recycling operation is detected that has the same name as the file to be deleted, the target string of the file to be deleted is obtained, wherein the recycling operation refers to the operation of moving the file with the same name to the target recycle bin, and the target string includes the deletion time and version number of the file to be deleted; The target string is added to the original filename of the file to be deleted to obtain the renamed filename of the file to be deleted, and the file with the same name is moved to the target recycle bin; If an empty directory is deleted, and there are no files with the same name as the empty directory in the recycle bin, the path to the empty directory is created in the recycle bin, and the empty directory is moved to the recycle bin. If there are files with the same name as the empty directory in the recycle bin, the empty directory is deleted from the file system.

2. The method according to claim 1, characterized in that, Before determining whether the target directory contains the target recycle bin, the method further includes: Receive the deletion request for the file to be deleted; If the deletion request instructs that the file to be deleted be placed in the trash bin, the file to be deleted is moved to the trash bin, wherein files in the trash bin cannot be recovered; If the deletion request instructs that the file to be deleted be placed in the recycle bin, the file to be deleted be moved to the target recycle bin.

3. The method according to claim 1, characterized in that, Determining whether the file to be deleted meets the recycling criteria includes: Determine whether the space occupied by the file to be deleted is less than or equal to the space threshold; If the space occupied by the file to be deleted is less than or equal to the space threshold, determine whether the type of the file to be deleted is a preset type; If the type of the file to be deleted is not the preset type, determine whether the suffix of the file to be deleted is the preset suffix; If the file extension to be deleted is not the preset extension, determine whether the remaining storage space of the target recycle bin is greater than or equal to the occupied space; If the remaining storage space in the target recycle bin is greater than or equal to the occupied space, the file to be deleted is determined to meet the recycling conditions.

4. The method according to claim 1, characterized in that, After moving the file to be deleted to the target recycle bin, the method further includes: Determine whether the target recycle bin has its periodic deletion function enabled; When the periodic deletion function is enabled in the target recycle bin, the deletion period of the target recycle bin is obtained, and the archiving period is determined based on the deletion period, wherein the archiving period is less than or equal to the deletion period; Determine whether the target recycle bin contains files according to the stated archiving period; If files exist in the target recycle bin, all files in the target recycle bin that are not in the archive directory are moved to the current archive directory. The target recycle bin contains archive directories, and different archive directories store files from different recycling time intervals.

5. The method according to claim 4, characterized in that, After moving all files in the target recycle bin that are not in the archive directory to the current archive directory, the method further includes: Determine whether the time between the creation time and the current time of each of the archive directories is greater than or equal to the deletion period; If the duration is greater than or equal to the deletion period, the files in the archive directory will be deleted from the target recycle bin.

6. The method according to claim 1, characterized in that, After moving the file to be deleted to the target recycle bin, the method further includes: Obtain the user's file retrieval request and parse the file retrieval request to obtain file filtering conditions, wherein the file retrieval request is used to retrieve the target file required by the user in the target recycle bin; Iterate through all files in the target recycle bin, determine whether each file meets the file filtering criteria, and identify the files that meet the file filtering criteria as the target search files.

7. A file recycling system, characterized in that, The file recycling method applied to any one of claims 1 to 6 includes: The file system is used to store multiple files and the directory where each file is located; The scheduling module is used to move files in the file system to the recycle bin or junk bin based on file deletion requests; A waste station, wherein the waste station is used to store files moved to the waste station; A recycle bin cluster includes multiple recycle bins, each recycle bin corresponding to a file directory, and each recycle bin is used to store files moved from the corresponding file directory to the recycle bin.

8. A document recycling device, characterized in that, include: The determining unit is used to determine the target directory of the file to be deleted in the file system when a request to delete a file to be deleted is received, and to determine whether there is a target recycle bin in the target directory. The file system is used to store files and the directories where the files are located. Different directories are set up with different recycle bins. The target recycle bin is the recycle bin of the target directory. The first judgment unit is used to determine whether the target recycle bin is in an open state when the target recycle bin exists in the target directory. The recycle bin corresponding to each directory can be dynamically controlled to be opened or closed. The second judgment unit is used to determine whether the file to be deleted meets the recycling conditions when the target recycle bin is in the open state. The recycling conditions are the admission conditions of the target recycle bin. Different admission conditions are dynamically set for different recycle bins. The admission conditions include at least the space occupied, file type, file extension and recycle bin capacity. A moving unit is used to move the file to be deleted to the target recycle bin if the file meets the recycling conditions. The device further includes: a sixth determining unit, configured to, upon receiving a request to delete the target directory, determine whether the parent directory of the target directory has a recycle bin, and if the parent directory does not have a recycle bin, move the target directory to a proxy recycle bin; a first moving unit, configured to, if the parent directory has a recycle bin, determine whether the parent directory's recycle bin is enabled, and if the parent directory's recycle bin is not enabled, move the target directory to the proxy recycle bin; and a seventh determining unit, configured to, if the parent directory has a recycle bin and the parent directory's recycle bin is enabled, determine whether the remaining space capacity of the parent directory's recycle bin is greater than a certain value. Regarding the space occupied by the target directory, if the remaining space capacity of the recycle bin of the parent directory is less than the space occupied by the target directory, the target directory is moved to the proxy recycle bin; the eighth determination unit is used to determine whether the target directory meets the recycling conditions for entering the recycle bin of the parent directory if the remaining space capacity of the recycle bin of the parent directory is greater than or equal to the space occupied by the target directory, and if the target directory does not meet the recycling conditions, the target directory is moved to the proxy recycle bin; the second move-in unit is used to move the target directory to the recycle bin of the parent directory if the target directory meets the recycling conditions; The moving unit includes: a creation module, used to create a recycle bin directory in the target recycle bin based on the target directory if the target directory has not been deleted, and to move the files to be deleted to the recycle bin directory; The device further includes: a second acquisition unit, configured to acquire a target string of the file to be deleted when a recycling operation of a file with the same name as the file to be deleted is detected, wherein the recycling operation refers to the operation of moving the file with the same name to the target recycle bin, and the target string includes the deletion time and version number of the file to be deleted; and an addition unit, configured to add the target string to the original file name of the file to be deleted to obtain the renamed file name of the file to be deleted, and move the file with the same name to the target recycle bin. If an empty directory is deleted, and there are no files with the same name as the empty directory in the recycle bin, the path to the empty directory is created in the recycle bin, and the empty directory is moved to the recycle bin. If there are files with the same name as the empty directory in the recycle bin, the empty directory is deleted from the file system.

9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the file recycling method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • File management method and device

    CN113704189A

  • File system processing method, recycle bin management method, device and equipment

    CN114490516A