CN115098444A - Directory data processing method and device, electronic equipment and storage medium - Google Patents

Directory data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115098444A
CN115098444A CN202210831913.2A CN202210831913A CN115098444A CN 115098444 A CN115098444 A CN 115098444A CN 202210831913 A CN202210831913 A CN 202210831913A CN 115098444 A CN115098444 A CN 115098444A
Authority
CN
China
Prior art keywords
directory
directories
subset
hierarchy
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210831913.2A
Other languages
Chinese (zh)
Inventor
荣伟光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202210831913.2A priority Critical patent/CN115098444A/en
Publication of CN115098444A publication Critical patent/CN115098444A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9017Indexing; Data structures therefor; Storage structures using directory or table look-up
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9035Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a directory data processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. One embodiment of the method comprises: in response to a processing instruction of the directory data, extracting a directory set under the initial directory and adding a hierarchy tag; calculating the file size corresponding to each directory, and determining the total value of the file sizes corresponding to the initial directories to screen a first directory subset meeting a first preset condition; determining directories belonging to the same hierarchy based on the hierarchy labels, and screening a second directory subset meeting a second preset condition in each hierarchy by combining the corresponding file size; and determining and displaying other directories except the first directory subset and the second directory subset in the directory set as the directories to be processed so as to process the directories to be processed. The implementation method can solve the problems that in the prior art, manual screening is needed after multi-level directories are screened out, so that the operation is complex and the efficiency is low.

Description

Directory data processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing directory data, an electronic device, and a storage medium.
Background
In a service system, large files are generated due to factors such as service operation, the space occupancy rate of the files is high, and the files need to be cleared in order to improve the system performance. In the prior art, a multi-level directory including a large file is usually selected, because the large file is usually located in a low-level directory, the selected multi-level directory includes a high-level directory to which the large file belongs, and the high-level directories also include other small files, after the multi-level directory is selected, manual screening is required to identify the large bottommost directory and the large file for clearing, so that the operation is complex and the efficiency is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a directory data processing method and apparatus, an electronic device, and a storage medium, which can solve the problems of complex operation and low efficiency caused by manual screening after a multi-level directory is screened in the prior art.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a directory data processing method.
The directory data processing method of the embodiment of the invention comprises the following steps: responding to a processing instruction of directory data, acquiring a corresponding initial directory, so as to extract a directory set under the initial directory and add a hierarchy tag; calling a preset calculation command, calculating the file size corresponding to each directory, and determining the total value of the file sizes corresponding to the initial directories so as to screen a first directory subset meeting a first preset condition; determining directories belonging to the same hierarchy based on the hierarchy tags to screen a second directory subset meeting a second preset condition in each hierarchy in combination with the corresponding file size; and determining and displaying other directories except the first directory subset and the second directory subset in the directory set as the directories to be processed so as to process the directories to be processed.
In one embodiment, determining other directories in the directory set except the first directory subset and the second directory subset as the directories to be processed includes:
deleting the first directory subset and the second directory subset from the directory set;
and matching the deleted directory set with a preset directory set to obtain the directory to be processed.
In another embodiment, determining other directories in the directory set except the first directory subset and the second directory subset as pending directories includes:
deleting the first directory subset and the second directory subset from the directory set;
and sequentially screening and deleting the high-level directories to which the directories belong from the deleted directory set based on the sequence of the hierarchical labels from low to high so as to determine the directories to be processed.
In another embodiment, sequentially filtering and deleting the high-level directory to which each directory belongs from the updated directory set includes:
based on the hierarchical label, screening a directory with the lowest hierarchical level from the deleted directory set as a target directory;
determining a high-level directory to which the target directory belongs based on the path of the target directory;
deleting the high-level directory in response to the deleted directory set comprising the high-level directory; in response to the deleted set of directories not including the higher level directory, no operation is performed.
In yet another embodiment, the first preset condition comprises a first threshold;
the screening of the first directory subset meeting the first preset condition includes:
calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value;
and determining the directory with the ratio smaller than the first preset threshold value as a first directory to obtain the first directory subset.
In yet another embodiment, the second preset condition includes a second threshold corresponding to each level;
before the screening, in combination with the corresponding file size, a second directory subset satisfying a second preset condition in each hierarchy, the method further includes:
for each hierarchy, determining a second threshold corresponding to the hierarchy by using a statistical value of file sizes corresponding to directories belonging to the hierarchy;
the screening, in combination with the corresponding file size, a second directory subset satisfying a second preset condition in each level includes:
for each level, determining the directory with the corresponding file size smaller than the corresponding second threshold as a second directory to obtain the second directory subset.
In another embodiment, the processing the to-be-processed directory includes:
receiving a deletion instruction of a user, and acquiring a directory to be deleted in the deletion instruction;
triggering a backup instruction of the directory to be deleted so as to enable the directory to be deleted to correspond to the file backup;
and in response to the successful backup of the file corresponding to the directory to be deleted, deleting the file corresponding to the directory to be deleted.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a directory data processing apparatus.
A directory data processing apparatus according to an embodiment of the present invention includes: the acquisition unit is used for responding to a processing instruction of the directory data, acquiring a corresponding initial directory, extracting a directory set under the initial directory and adding a hierarchy label; the screening unit is used for calling a preset calculation command, calculating the file size corresponding to each directory, and determining the total value of the file sizes corresponding to the initial directories so as to screen a first directory subset meeting a first preset condition; the screening unit is further used for determining directories belonging to the same hierarchy based on the hierarchy tags so as to screen a second directory subset meeting a second preset condition in each hierarchy by combining the corresponding file size; and the processing unit is used for determining and displaying other catalogues except the first catalog subset and the second catalog subset in the catalog set as the catalogues to be processed so as to process the catalogues to be processed.
In an embodiment, the processing unit is specifically configured to:
deleting the first directory subset and the second directory subset from the directory set;
and matching the deleted directory set with a preset directory set to obtain the directory to be processed.
In another embodiment, the processing unit is specifically configured to:
deleting the first directory subset and the second directory subset from the directory set;
and sequentially screening and deleting the high-level directories to which the directories belong from the deleted directory set based on the sequence of the hierarchical labels from low to high so as to determine the directories to be processed.
In yet another embodiment, the first preset condition comprises a first threshold;
the screening unit is specifically configured to:
calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value;
and determining the directory with the ratio smaller than the first preset threshold value as a first directory to obtain the first directory subset.
In yet another embodiment, the second preset condition includes a second threshold corresponding to each level;
the screening unit is specifically configured to:
for each hierarchy, determining a second threshold corresponding to the hierarchy by using a statistical value of file sizes corresponding to directories belonging to the hierarchy;
for each level, determining the directory having a corresponding file size smaller than a corresponding second threshold as a second directory to obtain the second directory subset.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the directory data processing method provided by the embodiment of the invention.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention stores thereon a computer program, which, when executed by a processor, implements a directory data processing method provided by an embodiment of the present invention.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer program product.
A computer program product according to an embodiment of the present invention includes a computer program, and when the computer program is executed by a processor, the computer program implements the directory data processing method according to an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: in the embodiment of the invention, the file size corresponding to each directory under the initial directory is calculated, the subdirectory set with smaller overall occupancy rate is screened out from the overall directory angle, and the subdirectory set with smaller hierarchical occupancy rate is screened out from the hierarchical directory angle, so that the to-be-processed directory under the initial directory is determined from the overall directory angle and the hierarchical directory angle, the to-be-processed directory is prevented from including the directory with smaller occupancy rate as far as possible, and the accuracy of determining the to-be-processed directory and the processing efficiency of the to-be-processed directory are improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a directory data processing method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of another main flow of a directory data processing method according to an embodiment of the invention;
FIG. 3 is a schematic diagram of yet another major flow of a directory data processing method according to an embodiment of the invention;
fig. 4 is a schematic diagram of the main units of a directory data processing apparatus according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing embodiments of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
Embodiments of the present invention provide a directory data processing system, which may be used in a scenario where directories in the system are processed, and in particular, may be used to process directory data including a large file in the system.
An embodiment of the present invention provides a directory data processing method, which may be executed by a directory data processing system, as shown in fig. 1, and the method includes:
s101: and responding to a processing instruction of the directory data, acquiring a corresponding initial directory, so as to extract a directory set under the initial directory and add a hierarchy tag.
The processing instruction of the directory data may be automatically triggered by the directory data processing system, for example, the directory data processing system may set a processing instruction triggered at a timing to process the directory data at a timing, and the processing instruction of the directory data may also be sent from outside the directory data processing system, for example, a user sends the processing instruction to the directory data processing system through other terminal devices.
After the processing instruction is triggered, the corresponding response program may be executed, and the processing instruction may include an initial directory, where the initial directory represents a directory corresponding to the current directory data processing, that is, a highest-level directory corresponding to the current directory data processing, and thus, in this step, the corresponding initial directory may be obtained from the processing instruction. After the initial directory is determined, a directory set below the initial directory can be extracted and processed, the directory set comprises directories of all hierarchies below the initial directory, and for convenience of subsequent directory data processing, hierarchy labels can be added to all directories in the target set to represent the hierarchies of all the directories in the directory set.
Specifically, in the embodiment of the present invention, a command for acquiring a directory, such as a du command, may be preset, so as to extract a directory set and a hierarchy of each directory in an initial directory by invoking the command, and further add a hierarchy tag to each directory in a target set. After the directory set is obtained, the directory set may be stored in an array, and the directory set is stored in the array, for example, each directory may be represented by a path of each directory, and the path of each directory is stored in preset data.
It should be noted that, in the embodiment of the present invention, after the initial directory is obtained, it may be determined whether the initial directory exists in the system, and if the initial directory exists, a subsequent processing procedure is executed; if not, a prompt message may be triggered for transmission or display to prompt for other processing.
S102: and calling a preset calculation command, calculating the file size corresponding to each directory, and determining the total value of the file sizes corresponding to the initial directories so as to screen a first directory subset meeting a first preset condition.
The calculation command is preset, specifically, the calculation command may be a du command, and the size of the file corresponding to each directory, that is, the size of the file under each directory, may be calculated by calling the preset calculation command, and meanwhile, the attribute parameters of each directory, such as the name and path of the directory, the file parameters of the file corresponding to the directory, and the like, may also be obtained.
In the embodiment of the invention, after the size of the file corresponding to each directory is determined, the total value of the size of the file corresponding to the initial directory, that is, the sum of the sizes of the files included in the initial directory can be calculated, and then the first directory subset can be screened out through a first preset condition, that is, the directory set which does not need to be processed is screened out.
Specifically, in the embodiment of the present invention, for example, processing directory data including large files is performed, in this step, the first preset condition may include a first threshold, where the first threshold represents a threshold of a ratio between a file size corresponding to each directory and a total value of file sizes corresponding to initial directories. If the ratio of the size of the file corresponding to the directory to the total size of the file corresponding to the initial directory is not larger than the threshold value, the size of the file corresponding to the directory is larger; and if the ratio of the size of the file corresponding to the directory to the total size of the file corresponding to the initial directory is smaller than the threshold value, the size of the file corresponding to the directory is smaller. Therefore, the screening of the first directory subset in this step may be specifically performed as: calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value; and determining the directory with the ratio smaller than a first preset threshold value as the first directory to obtain a first directory subset.
It should be noted that, in the embodiment of the present invention, the value of the first threshold may be set based on the requirement, and may be set to 20%, for example.
S103: and determining the directories belonging to the same hierarchy based on the hierarchy tags so as to screen a second directory subset meeting a second preset condition in each hierarchy by combining the corresponding file sizes.
Since some directories in the directory set belong to the same hierarchy, the directory hierarchy belonging to the same hierarchy can be determined based on the hierarchy tag, and further, the directory screening can be performed again from the perspective of the hierarchical directory.
In the embodiment of the invention, after the catalogs belonging to the same hierarchy in the catalog set are obtained, the catalogs of each hierarchy are respectively processed. Specifically, for the directory of each hierarchy, a second directory subset meeting a second preset condition in the hierarchy may be screened in combination with the file size corresponding to each directory in the hierarchy.
The second preset condition includes a second threshold corresponding to each hierarchy level.
The second threshold may represent a threshold of the size of the file corresponding to the directory, and if the size of the file corresponding to the directory is smaller than the second threshold corresponding to the hierarchy to which the directory belongs, it is indicated that the size of the file corresponding to the directory is smaller; and if the size of the file corresponding to the directory is not smaller than the second threshold corresponding to the hierarchy to which the directory belongs, the size of the file corresponding to the directory is larger. Therefore, the screening of the second directory subset in this step may be specifically performed as: for each level, determining the directory with the corresponding file size smaller than the corresponding second threshold as a second directory to obtain a second directory subset.
It should be noted that, because directories included in different hierarchies are different and corresponding file sizes are also different, in the embodiment of the present invention, corresponding second thresholds may be determined for different hierarchies. Specifically, in the embodiment of the present invention, for each hierarchy, the statistical value of the file size corresponding to the directory belonging to the hierarchy may be determined as the second threshold corresponding to the hierarchy, and the statistical value may be an average value, that is, the average value of the file size corresponding to the directory included in each hierarchy is determined as the second threshold corresponding to the hierarchy.
The second threshold may also represent a threshold of a ratio between the size of the file corresponding to the directory and the size of the file corresponding to the directory included in the hierarchy to which the directory belongs, and if the ratio between the size of the file corresponding to the directory and the size of the file corresponding to the directory included in the hierarchy to which the directory belongs is smaller than the second threshold corresponding to the hierarchy to which the directory belongs, it is indicated that the size of the file corresponding to the directory is smaller; and if the ratio of the size of the file corresponding to the directory to the size of the file corresponding to the directory included in the hierarchy to which the directory belongs is not smaller than a second threshold corresponding to the hierarchy to which the directory belongs, the size of the file corresponding to the directory is larger. Therefore, the screening of the second directory subset in this step may be specifically performed as: and for each level, calculating the ratio of the file size corresponding to each directory included in the level to the file size corresponding to the directory included in the level, and determining the directory with the ratio smaller than a second threshold value corresponding to the level as a second directory to obtain a second directory subset. In the embodiment of the present invention, the value of the second threshold may be set based on the requirement, for example, may be set to 20%.
S104: and determining and displaying other directories except the first directory subset and the second directory subset in the directory set as the directories to be processed so as to process the directories to be processed.
In the embodiment of the present invention, the first directory subset and the second directory subset are screened out through steps S102 and S103, and it can be determined that other directories in the directory set except the first directory subset and the second directory subset are determined to be the directories to be processed, and the directories to be processed can be displayed, so as to process the directories to be processed.
In some embodiments, although files in a directory are large, the files under the directories cannot be processed and need to be retained due to factors such as importance or other purposes, so that in the embodiments of the present invention, a set of the directories, that is, a preset directory set, may be preset to prevent directory data in the set from being processed. So determining the to-be-processed directory in this step can be performed as: deleting the first directory subset and the second directory subset from the directory set; and matching the deleted directory set with a preset directory set to obtain the directory to be processed. The deleted directory set represents a directory set obtained by deleting the first directory sub-set and the second directory sub-set from the directory set, and the directory set is an updated directory set; and matching the updated directory set with a preset directory set to obtain the directory to be processed. The updated directory set does not include the first directory subset and the second directory subset, that is, the directory with the smaller corresponding file is deleted, so that the updated directory set can be matched with the preset directory set, a directory set with successful matching and a directory set with unsuccessful matching can be obtained, and the directory set with unsuccessful matching can be determined as a set to be processed for display.
It should be noted that, in order to facilitate the user to view the directory with a larger corresponding file in the initial directory, the directory set that is successfully matched may also be displayed. In the embodiment of the invention, the directories which comprise large files and are not suitable for processing can be screened in advance through the preset directory set, so that the accuracy of the directories to be processed is further improved.
In still other embodiments, some directories may have larger files because the files corresponding to the lower directory included in the directory are larger, so that the higher directory does not need to be processed after the lower directory included in the directory is processed. Therefore, in this step, the first directory subset and the second directory subset may be deleted from the directory set to obtain a deleted directory set, that is, an updated directory set, and then, on the basis of the sequence of the hierarchical labels from low to high, for each directory in the updated directory set, a higher-level directory belonging to the updated directory set is sequentially screened from the updated directory set and deleted, so as to delete a higher level and a directory corresponding to a lower-level directory in the updated directory set, thereby determining the remaining directories in the updated directory set as the directories to be processed.
Specifically, this step may be performed as: based on the hierarchical label, screening a directory with the lowest hierarchical level from the deleted directory set as a target directory; determining a high-level directory to which the target directory belongs based on the path of the target directory; deleting the high-level directory in response to the deleted directory set comprising the high-level directory; in response to the deleted set of directories not including the higher level directory, no operation is performed. For example, it may be performed as: screening a directory with the lowest hierarchy from the updated directory set as a target directory based on the hierarchy label; acquiring a path of a target directory to determine a high-level directory to which the target directory belongs, and judging whether an updated directory set comprises the high-level directory; responding to the fact that the updated directory set comprises a high-level directory, deleting the high-level directory to obtain a re-updated directory set, and screening the directory set which is updated again and has the lowest level except the target directory to update as the target directory so as to execute the judging step; and in response to that the updated directory set does not comprise the high-level directory, not operating the directory set, and screening the directory with the lowest level except the target directory from the updated directory set to be updated as the target directory so as to execute the judging step until the directory with the lowest level except the target directory in the updated directory set is empty.
In the embodiment of the invention, after the directory to be processed is displayed, a deletion instruction input by a user can be received, the deletion instruction can comprise the directory to be deleted, and then a backup instruction of the directory to be deleted can be triggered, so that the directory to be deleted corresponds to a file backup; and in response to the successful backup of the file corresponding to the directory to be deleted, deleting the file corresponding to the directory to be deleted.
It should be noted that, in some scenarios, there may be a failure in the backup of the file corresponding to the directory due to a factor such as a right, so when the backup of the file corresponding to the directory to be deleted fails, a failure prompt message may be displayed to prompt the user to perform another operation.
In the embodiment of the invention, the file size corresponding to each directory under the initial directory is calculated, the subdirectory set with smaller overall occupancy rate is screened out from the overall directory angle, and the subdirectory set with smaller hierarchical occupancy rate is screened out from the hierarchical directory angle, so that the to-be-processed directory under the initial directory is determined from the overall directory angle and the hierarchical directory angle, the to-be-processed directory is prevented from including the directory with smaller occupancy rate as far as possible, and the accuracy of determining the to-be-processed directory and the processing efficiency of the to-be-processed directory are improved.
The following describes, in conjunction with the embodiment shown in fig. 1, a method for processing directory data in an embodiment of the present invention in detail, and as shown in fig. 2, the method includes:
s201: and responding to the processing instruction of the directory data, acquiring the corresponding initial directory, extracting a directory set under the initial directory, and adding a hierarchy label to each directory in the target set.
S202: and calling a preset calculation command, calculating the file size corresponding to each directory, and determining the total value of the file size corresponding to the initial directory.
S203: calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value; and determining the directory with the ratio smaller than the first preset threshold value as the first directory, and deleting the first directory from the directory set to obtain an updated directory set.
S204: and determining the directories belonging to the same hierarchy in the updated directory set based on the hierarchy tags.
S205: and for each level, determining the directory with the corresponding file size smaller than the corresponding second threshold as a second directory, and deleting the second directory from the updated directory set to obtain the directory set updated again.
S206: and matching the directory set updated again with the preset directory set to obtain the directory to be processed.
S207: and displaying the directory to be processed.
In the embodiment of the invention, the file size corresponding to each directory under the initial directory is calculated, the subdirectory set with smaller overall occupancy rate is screened out from the overall directory angle, and the subdirectory set with smaller hierarchical occupancy rate is screened out from the hierarchical directory angle, so that the directories to be processed under the initial directory are determined from the overall directory angle and the hierarchical directory angle, and the directories with smaller occupancy rate are avoided from being included in the directories to be processed as far as possible, thereby improving the accuracy of determining the directories to be processed and the processing efficiency of the directories to be processed.
With reference to the embodiments shown in fig. 1 and fig. 2, the following describes specifically a directory data processing method after step S207 in the embodiment of the present invention, and as shown in fig. 3, the method includes:
s301: receiving a deleting instruction of a user, and acquiring a directory to be deleted in the deleting instruction.
S302: and triggering a backup instruction of the directory to be deleted so as to make the directory to be deleted correspond to the file backup.
S303: and in response to the successful backup of the file corresponding to the directory to be deleted, deleting the file corresponding to the directory to be deleted.
S304: and responding to the backup failure of the file corresponding to the directory to be deleted, and displaying a prompt message of the backup failure.
In order to solve the problems in the prior art, an embodiment of the present invention provides a directory data processing apparatus 400, as shown in fig. 4, where the apparatus 400 includes:
an obtaining unit 401, configured to, in response to a processing instruction of directory data, obtain a corresponding initial directory, to extract a directory set under the initial directory and add a hierarchical tag;
a screening unit 402, configured to invoke a preset calculation command, calculate a file size corresponding to each directory, and determine a total value of the file sizes corresponding to the initial directories, so as to screen a first directory subset that meets a first preset condition;
a screening unit 402, configured to determine, based on the hierarchy tag, directories belonging to the same hierarchy, so as to screen, in combination with a corresponding file size, a second directory subset that meets a second preset condition in each hierarchy;
a processing unit 403, configured to determine and display other directories in the directory set except for the first directory subset and the second directory subset as directories to be processed, so as to process the directories to be processed.
It should be understood that the manner of implementing the embodiment of the present invention is the same as the manner of implementing the embodiment shown in fig. 1, and the description thereof is omitted.
In an embodiment, the processing unit 403 is specifically configured to:
deleting the first directory subset and the second directory subset from the directory set;
and matching the deleted directory set with a preset directory set to obtain the directory to be processed.
In another embodiment, the processing unit 403 is specifically configured to:
deleting the first directory subset and the second directory subset from the directory set;
and sequentially screening and deleting the high-level directories to which the directories belong from the deleted directory set based on the sequence of the hierarchical labels from low to high so as to determine the directories to be processed.
In another embodiment, the processing unit 403 is specifically configured to:
based on the hierarchical label, screening a directory with the lowest hierarchical level from the deleted directory set as a target directory;
determining a high-level directory to which the target directory belongs based on the path of the target directory;
deleting the high-level directory in response to the deleted directory set comprising the high-level directory; in response to the deleted set of directories not including the higher level directory, no operation is performed.
In yet another embodiment, the first preset condition comprises a first threshold;
the screening unit 402 is specifically configured to:
calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value;
and determining the directories with the ratio smaller than the first preset threshold value as first directories to obtain the first directory subset.
In yet another embodiment, the second preset condition includes a second threshold corresponding to each level;
the screening unit 402 is specifically configured to:
for each hierarchy, determining a second threshold corresponding to the hierarchy by using a statistical value of file sizes corresponding to directories belonging to the hierarchy;
for each level, determining the directory having a corresponding file size smaller than a corresponding second threshold as a second directory to obtain the second directory subset.
In another embodiment, the processing unit 403 is specifically configured to:
receiving a deletion instruction of a user, and acquiring a directory to be deleted in the deletion instruction;
triggering a backup instruction of the directory to be deleted to enable the directory to be deleted to correspond to the file backup;
and in response to the successful backup of the file corresponding to the directory to be deleted, deleting the file corresponding to the directory to be deleted.
It should be understood that the embodiment of the present invention is implemented in the same manner as the embodiment shown in fig. 1, 2, and 3, and is not repeated herein.
In the embodiment of the invention, the file size corresponding to each directory under the initial directory is calculated, the subdirectory set with smaller overall occupancy rate is screened out from the overall directory angle, and the subdirectory set with smaller hierarchical occupancy rate is screened out from the hierarchical directory angle, so that the to-be-processed directory under the initial directory is determined from the overall directory angle and the hierarchical directory angle, the to-be-processed directory is prevented from including the directory with smaller occupancy rate as far as possible, and the accuracy of determining the to-be-processed directory and the processing efficiency of the to-be-processed directory are improved.
According to an embodiment of the present invention, an electronic device and a readable storage medium are also provided.
The electronic device of the embodiment of the invention comprises: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the processor, and the instructions are executed by the at least one processor to cause the at least one processor to execute the directory data processing method provided by the embodiment of the invention.
Fig. 5 shows an exemplary system architecture 500 of a directory data processing method or a directory data processing apparatus to which embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is the medium used to provide communication links between terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. Various client applications may be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be, but are not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, and the server may analyze and process data such as a received product information query request, and feed back a processing result (for example, product information — just an example) to the terminal device.
It should be noted that the directory data processing method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the directory data processing apparatus is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for an implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use in implementing embodiments of the present invention is shown. The computer system illustrated in FIG. 6 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. A driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609 and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a unit, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a screening unit, and a comparison unit. The names of these units do not in some cases constitute a limitation on the unit itself, and for example, the acquisition unit may also be described as a "unit of directory acquisition function".
As another aspect, the present invention also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer-readable medium carries one or more programs which, when executed by a device, cause the device to perform the directory data processing method provided by the present invention.
As another aspect, the present invention further provides a computer program product including a computer program, where the computer program is executed by a processor to implement the directory data processing method provided by the embodiment of the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (15)

1. A directory data processing method, comprising:
responding to a processing instruction of directory data, acquiring a corresponding initial directory, so as to extract a directory set under the initial directory and add a hierarchy tag;
calling a preset calculation command, calculating the file size corresponding to each directory, and determining the total value of the file sizes corresponding to the initial directories so as to screen a first directory subset meeting a first preset condition;
determining directories belonging to the same hierarchy based on the hierarchy tags to screen a second directory subset meeting a second preset condition in each hierarchy in combination with the corresponding file size;
and determining and displaying other directories in the directory set except the first directory subset and the second directory subset as the directories to be processed so as to process the directories to be processed.
2. The method of claim 1, wherein determining other directories in the set of directories, except for the first subset of directories and the second subset of directories, as pending directories comprises:
deleting the first directory subset and the second directory subset from the directory set;
and matching the deleted directory set with a preset directory set to obtain a directory to be processed.
3. The method of claim 1, wherein determining other directories in the set of directories, except for the first subset of directories and the second subset of directories, as pending directories comprises:
deleting the first directory subset and the second directory subset from the directory set;
and sequentially screening and deleting the high-level directories to which the directories belong from the deleted directory set based on the sequence of the hierarchical labels from low to high so as to determine the directories to be processed.
4. The method of claim 3, wherein sequentially filtering and deleting the higher-level directory to which each directory belongs from the updated directory set comprises:
based on the hierarchical label, screening a directory with the lowest hierarchical level from the deleted directory set as a target directory;
determining a high-level directory to which the target directory belongs based on the path of the target directory;
deleting the high-level directory in response to the deleted directory set comprising the high-level directory; in response to the deleted set of directories not including the higher level directory, no operation is performed.
5. The method according to claim 1, wherein the first preset condition comprises a first threshold value;
the screening of the first directory subset meeting the first preset condition includes:
calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value;
and determining the directory with the ratio smaller than the first preset threshold value as a first directory to obtain the first directory subset.
6. The method according to claim 1, wherein the second preset condition includes a second threshold corresponding to each level;
before the screening, in combination with the corresponding file size, a second directory subset satisfying a second preset condition in each hierarchy, the method further includes:
for each hierarchy, determining a statistical value of the file size corresponding to the directory belonging to the hierarchy as a second threshold corresponding to the hierarchy;
and screening a second directory subset meeting a second preset condition in each hierarchy by combining the corresponding file size, wherein the screening comprises the following steps:
for each level, determining the directory with the corresponding file size smaller than the corresponding second threshold as a second directory to obtain the second directory subset.
7. The method of claim 1, wherein processing the to-be-processed directory comprises:
receiving a deleting instruction of a user, and acquiring a directory to be deleted in the deleting instruction;
triggering a backup instruction of the directory to be deleted so as to enable the directory to be deleted to correspond to the file backup;
and in response to the successful backup of the file corresponding to the directory to be deleted, deleting the file corresponding to the directory to be deleted.
8. A directory data processing apparatus, comprising:
the acquisition unit is used for responding to a processing instruction of the directory data, acquiring a corresponding initial directory, extracting a directory set under the initial directory and adding a hierarchy label;
the screening unit is used for calling a preset calculation command, calculating the size of the file corresponding to each directory, and determining the total value of the size of the file corresponding to the initial directory so as to screen a first directory subset meeting a first preset condition;
the screening unit is further used for determining directories belonging to the same hierarchy based on the hierarchy tags so as to screen a second directory subset meeting a second preset condition in each hierarchy by combining the corresponding file size;
and the processing unit is used for determining and displaying other catalogues except the first catalog subset and the second catalog subset in the catalog set as the catalogues to be processed so as to process the catalogues to be processed.
9. The apparatus according to claim 8, wherein the processing unit is specifically configured to:
deleting the first directory subset and the second directory subset from the directory set;
and matching the deleted directory set with a preset directory set to obtain the directory to be processed.
10. The apparatus according to claim 8, wherein the processing unit is specifically configured to:
deleting the first directory subset and the second directory subset from the directory set;
and sequentially screening and deleting the high-level directories to which the directories belong from the deleted directory set based on the sequence of the hierarchical labels from low to high so as to determine the directories to be processed.
11. The apparatus of claim 8, wherein the first predetermined condition comprises a first threshold;
the screening unit is specifically configured to:
calculating the ratio of the size of the file corresponding to each directory in the directory set to the total value;
and determining the directories with the ratio smaller than the first preset threshold value as first directories to obtain the first directory subset.
12. The apparatus according to claim 8, wherein the second predetermined condition comprises a second threshold corresponding to each level;
the screening unit is specifically configured to:
for each hierarchy, determining a second threshold corresponding to the hierarchy by using a statistical value of file sizes corresponding to directories belonging to the hierarchy;
for each level, determining the directory with the corresponding file size smaller than the corresponding second threshold as a second directory to obtain the second directory subset.
13. An electronic device, comprising:
one or more processors;
a storage device to store one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
15. A computer program product comprising a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-7.
CN202210831913.2A 2022-07-14 2022-07-14 Directory data processing method and device, electronic equipment and storage medium Pending CN115098444A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210831913.2A CN115098444A (en) 2022-07-14 2022-07-14 Directory data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210831913.2A CN115098444A (en) 2022-07-14 2022-07-14 Directory data processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115098444A true CN115098444A (en) 2022-09-23

Family

ID=83298930

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210831913.2A Pending CN115098444A (en) 2022-07-14 2022-07-14 Directory data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115098444A (en)

Similar Documents

Publication Publication Date Title
CN107480205B (en) Method and device for partitioning data
CN111427701A (en) Workflow engine system and business processing method
CN111460129A (en) Method and device for generating identification, electronic equipment and storage medium
CN112596920A (en) Message processing method and device, electronic equipment and storage medium
CN112748866A (en) Method and device for processing incremental index data
CN112118352B (en) Method and device for processing notification trigger message, electronic equipment and computer readable medium
CN113535420A (en) Message processing method and device
CN106933449B (en) Icon processing method and device
CN115098444A (en) Directory data processing method and device, electronic equipment and storage medium
CN114116675A (en) Data archiving method and device
CN109087097B (en) Method and device for updating same identifier of chain code
CN111737218A (en) File sharing method and device
CN109213815B (en) Method, device, server terminal and readable medium for controlling execution times
CN112711572A (en) Online capacity expansion method and device suitable for sub-warehouse and sub-meter
CN111176679A (en) Application program updating method and device
CN113127561A (en) Method and device for generating service order number, electronic equipment and storage medium
CN111179097B (en) Method, device, electronic equipment and storage medium for modifying warranty
CN112306371A (en) Method, apparatus and computer program product for storage management
CN113766437B (en) Short message sending method and device
CN110262756B (en) Method and device for caching data
CN111460269B (en) Information pushing method and device
CN113746661A (en) Service processing method and device
CN114490583A (en) Data migration method and device, electronic equipment and storage medium
CN113722548A (en) Method and device for processing reference relationship in business system
CN112487001A (en) Method and device for processing request

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination