CN117290302B - Directory separation method, apparatus, computer device and storage medium - Google Patents

Directory separation method, apparatus, computer device and storage medium Download PDF

Info

Publication number
CN117290302B
CN117290302B CN202311569042.2A CN202311569042A CN117290302B CN 117290302 B CN117290302 B CN 117290302B CN 202311569042 A CN202311569042 A CN 202311569042A CN 117290302 B CN117290302 B CN 117290302B
Authority
CN
China
Prior art keywords
data
current
path information
list
absolute path
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.)
Active
Application number
CN202311569042.2A
Other languages
Chinese (zh)
Other versions
CN117290302A (en
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.)
Hexin Technology Co ltd
Hexin Technology Suzhou Co ltd
Original Assignee
Hexin Technology Co ltd
Hexin Technology Suzhou 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 Hexin Technology Co ltd, Hexin Technology Suzhou Co ltd filed Critical Hexin Technology Co ltd
Priority to CN202311569042.2A priority Critical patent/CN117290302B/en
Publication of CN117290302A publication Critical patent/CN117290302A/en
Application granted granted Critical
Publication of CN117290302B publication Critical patent/CN117290302B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • 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/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application relates to a directory splitting method, a directory splitting device, computer equipment and a storage medium. The method comprises the following steps: acquiring a current du data list consisting of du data to be subjected to catalog separation, and acquiring absolute path information corresponding to each du data in the current du data list; for any one current du data in the current du data list, acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data; if the inclusion relation characterizes that the first absolute path information does not contain the second absolute path information, writing the current du data into a first sub du data list corresponding to the current du data list; and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with the separation catalog level under the condition that the catalog separation round reaches a target separation round matched with the preset separation catalog level. The method can improve the processing efficiency of directory separation.

Description

Directory separation method, apparatus, computer device and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a directory splitting method, apparatus, computer device, storage medium, and computer program product.
Background
With the development of computer technology, a development technology for computer chips has emerged, in which a large number of intermediate files are usually generated over time. For the user, if the above-generated intermediate files, and the directories of the files, need to be queried one by one to achieve management of the intermediate files, a great deal of time and effort is generally wasted.
In the conventional technology, a user can increase management efficiency through a system command du, however, the system command du can list all files and directories in a deep traversal mode, but if the user needs to separate directories of different levels from each other, for example, a file representing a primary directory, a secondary directory only containing files, and other high-level directories, the user needs to manually judge the directory levels corresponding to each piece of du data according to the obtained du data, and then separate and integrate the two. Therefore, in the current method of separating different hierarchical directories from du data, the processing efficiency of directory separation is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a directory splitting method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the directory splitting processing efficiency.
In a first aspect, the present application provides a directory splitting method, including:
acquiring a current du data list consisting of du data to be subjected to catalog separation, and acquiring absolute path information corresponding to each du data in the current du data list; the du data is obtained by executing a command for checking the use condition of the disk;
acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data;
if the inclusion relation characterizes that the first absolute path information does not contain the second absolute path information, writing the current du data into a first sub du data list corresponding to the current du data list;
and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub-du data list as a separation catalog list matched with a preset separation catalog level under the condition that the catalog separation round reaches a target separation round matched with the separation catalog level.
In one embodiment, the acquiring the path information inclusion relationship between the first absolute path information and the second absolute path information associated with the current du data includes: acquiring a first pointer value of a first pointer associated with the current du data, and assigning the second absolute path information to a second pointer; the first pointer value is used for storing the first absolute path information; and obtaining the path information inclusion relation according to the pointer value inclusion relation between the first pointer value and the second pointer value of the second pointer.
In one embodiment, after the obtaining the path information includes a relationship, the method further includes: assigning the second pointer value to the first pointer to obtain an updated first pointer; the updated first pointer is used for storing first absolute path information associated with the next du data of the current du data in the current du data list.
In one embodiment, in a case that the current du data is the first du data in the current du data list, before the acquiring the first pointer value of the first pointer associated with the current du data, the method further includes: and setting a first pointer value of the first pointer and a second pointer value of the second pointer to be null values.
In one embodiment, after the obtaining the path information containing relationship between the first absolute path information corresponding to the du data that is the last piece of the current du data in the current du data list and the second absolute path information corresponding to the current du data, the method further includes: if the path information containing relation characterizes that the first absolute path information contains the second absolute path information, writing the current du data into a second sub du data list corresponding to the current du data list; after the catalog separation round corresponding to the current du data list is obtained, the method further comprises the following steps: and under the condition that the catalog separation round does not reach the target separation round, taking the second sub du data list as a new current du data list, and returning to execute the step of acquiring absolute path information corresponding to each du data in the current du data list until the catalog separation round reaches the target separation round.
In one embodiment, the obtaining the current du data list including du data to be catalogued and separated includes: responding to a command initiated by a target account for checking the use condition of a disk, acquiring corresponding du data, and storing the corresponding du data into a text document associated with the target account; and reading the text document into a memory, and generating a du data list matched with the text document as the current du data list.
In one embodiment, the current du data list further stores a directory capacity of a directory represented by each du data; writing the current du data into a first sub-du data list corresponding to the current du data list, and further including: writing the current du data and the directory capacity corresponding to the current du data into the first sub-du data list; after the first subdu data list is used as the separated directory list matched with the separated directory hierarchy, the method further comprises the following steps: acquiring catalog capacity corresponding to each du data contained in the separated catalog list; sorting all du data contained in the separated directory list according to the directory capacity, and storing the pre-preset number of du data with the largest directory capacity in all du data contained in the separated directory list into a result path file; and carrying out visual display processing on the result path file.
In a second aspect, the present application further provides a directory splitting device, including:
the du list acquisition module is used for acquiring a current du data list consisting of du data to be subjected to directory separation and acquiring absolute path information corresponding to each du data in the current du data list;
The path containing acquisition module is used for acquiring a path information containing relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data;
a sub-du list obtaining module, configured to write the current du data into a first sub-du data list corresponding to the current du data list if the inclusion relation indicates that the first absolute path information does not include the second absolute path information;
the separation catalog acquisition module is used for acquiring catalog separation rounds corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with a separation catalog level under the condition that the catalog separation rounds reach the preset separation catalog level.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
Acquiring a current du data list consisting of du data to be subjected to catalog separation, and acquiring absolute path information corresponding to each du data in the current du data list;
acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data;
if the inclusion relation characterizes that the first absolute path information does not contain the second absolute path information, writing the current du data into a first sub du data list corresponding to the current du data list;
and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with a preset separation catalog level under the condition that the catalog separation round reaches the separation catalog level.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Acquiring a current du data list consisting of du data to be subjected to catalog separation, and acquiring absolute path information corresponding to each du data in the current du data list;
acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data;
if the inclusion relation characterizes that the first absolute path information does not contain the second absolute path information, writing the current du data into a first sub du data list corresponding to the current du data list;
and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with a preset separation catalog level under the condition that the catalog separation round reaches the separation catalog level.
In a fifth aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of:
Acquiring a current du data list consisting of du data to be subjected to catalog separation, and acquiring absolute path information corresponding to each du data in the current du data list;
acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data;
if the inclusion relation characterizes that the first absolute path information does not contain the second absolute path information, writing the current du data into a first sub du data list corresponding to the current du data list;
and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with a preset separation catalog level under the condition that the catalog separation round reaches the separation catalog level.
The catalog separation method, the catalog separation device, the computer equipment, the storage medium and the computer program product are characterized in that a current du data list consisting of du data to be catalog separated is obtained, and absolute path information corresponding to each du data in the current du data list is obtained; the du data is obtained by executing a command for checking the use condition of the disk; for any one current du data in the current du data list, acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data; if the second absolute path information is not contained in the first absolute path information of the containing relation representation, writing the current du data into a first sub du data list corresponding to the current du data list; and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with the separation catalog level under the condition that the catalog separation round reaches a target separation round matched with the preset separation catalog level. According to the method and the device, the current du data list consisting of the du data to be subjected to catalog separation is constructed, absolute path information corresponding to each du data of the list is obtained, absolute paths of any one current du data in the list are compared by using the absolute path information, and the containing relation between the absolute paths corresponding to the last du data of the du data is used, so that the current du data can be written into the first sub-du data list under the condition that the absolute paths corresponding to the last du data do not contain the absolute paths of the current du data, and when catalog separation turns meet the separation catalog level, the separated first sub-du data list is used as the separation catalog list, and therefore catalog separation is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is a flow diagram of a directory splitting method in one embodiment;
FIG. 2 is a flow chart of a method for obtaining path information inclusion in one embodiment;
FIG. 3 is a flow diagram of acquiring a current du data list in one embodiment;
FIG. 4 is a flow diagram of a visual presentation of a high-volume catalog in one embodiment;
FIG. 5 is a flow chart of a method of statistical analysis of files and directories according to one embodiment;
FIG. 6 is a block diagram of a directory splitting device in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a directory splitting method is provided, where this embodiment is applied to a terminal to illustrate the method, and it is understood that the method may also be applied to a server, and may also be applied to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step S101, a current du data list composed of du data to be subjected to catalog separation is obtained, and absolute path information corresponding to each du data in the current du data list is obtained; du data is obtained by executing a command for checking the disk usage.
The du data to be subjected to directory separation refers to du data required to perform directory separation operation, and the du data may be du data obtained after a user initiates a du command, that is, a command for checking a disc service condition, and not subjected to directory separation yet, or remaining du data required to continue directory separation after directory separation has been performed. The current du data list refers to a data list composed of the du data to be catalogued and separated, and the absolute path information is the complete path information corresponding to each du data in the list.
In this embodiment, after executing the du command for checking the usage situation of the disc, the terminal may obtain du data that is currently required to be subjected to directory separation, where the du data may form a current du data list, and in the du data, complete path information of each file or directory obtained by traversing the du command may also be stored, and the terminal may use the complete path information as absolute path information, thereby obtaining absolute path information of each du data in the current du data list.
Step S102, obtaining a path information inclusion relation between first absolute path information and second absolute path information associated with current du data aiming at any current du data in a current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data.
The current du data refers to any row of du data in the current du data list, the first absolute path information associated with the current du data refers to absolute path information corresponding to the last du data of the current du data, and the second absolute path information associated with the current du data refers to absolute path information corresponding to the current du data.
After obtaining the current du data list, the terminal may further take each du data in the current du data list as current du data one by one, and obtain first absolute path information and second absolute path information associated with each current du data respectively, so as to determine whether the first absolute path information associated with each current du data includes the second absolute path information, and further obtain a path information inclusion relationship corresponding to each current du data.
Step S103, if the second absolute path information is not contained in the first absolute path information of the containing relation representation, writing the current du data into a first sub du data list corresponding to the current du data list;
step S104, obtaining the catalog separation round corresponding to the current du data list, and taking the first sub-du data list as a separation catalog list matched with the separation catalog level under the condition that the catalog separation round reaches the target separation round matched with the preset separation catalog level.
The first sub du data list is a data list formed by separating out part of du data from the current du data list, the directory separation round refers to the round of performing directory separation currently, the separated directory level refers to a preset level of the directory to be separated, and if files representing a first-level directory need to be separated, the separated directory level can be a first-level directory. If a secondary directory containing only files is to be split, the split directory hierarchy may be secondary, and so on. The target separation round refers to a catalog separation round matched with a preset catalog level, if a primary catalog needs to be separated, the catalog separation round can be set to 1, and if a secondary catalog needs to be separated, the catalog separation round can be set to 2.
In this embodiment, since du data is traversed according to depth, the deeper the hierarchy, the more forward, then taking the directory splitting round as an example, if absolute path information corresponding to the last du data of a certain current du data, that is, the first absolute path information associated with the du data, and if absolute path information of the current du data, that is, the second absolute path information associated with the du data, is included, it is stated that the directory corresponding to the last du data is inside the directory corresponding to the current du data, and the current du data is the upper directory of the last du data, then the directory corresponding to the current du data is not necessarily a file characterizing the first-level directory. And only the second absolute path information is not contained in the containing relation representation first absolute path information, and the relation between the current du data and the last du data does not exist between the upper and lower levels of the directory, in this case, it can be indicated that the current du data corresponds to the file representing the primary directory, so by writing the current du data into the first sub-du data list, all the du data stored in the first sub-du data list can be used for representing the file representing the primary directory, therefore, in this way, if a user needs to separate the file representing the primary directory, the target separation round with matched levels of the separation directory can be set to be 1, and then the terminal only needs to execute one directory separation operation, thereby obtaining the first sub-du data list serving as the separated file list.
Similarly, if the secondary catalog is required to be separated, since the file representing the primary catalog is already separated when the current du data list is separated for the first time, if the du data separation is performed again, that is, the processes from step S102 to step S103 are performed again, the secondary catalog is the catalog with the deepest hierarchy in the remaining du data, so that the secondary catalog can be separated from other high-level catalogs, such as the tertiary catalog, by this way, the user only needs to set the target separation round to be 2, and the terminal only needs to perform 2 catalog separation operations, thereby realizing the separation of the secondary catalog.
In the catalog separation method, the current du data list consisting of du data to be catalog-separated is obtained, and absolute path information corresponding to each du data in the current du data list is obtained; the du data is obtained by executing a command for checking the use condition of the disk; for any one current du data in the current du data list, acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data; if the second absolute path information is not contained in the first absolute path information of the containing relation representation, writing the current du data into a first sub du data list corresponding to the current du data list; and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with the separation catalog level under the condition that the catalog separation round reaches a preset target separation round matched with the separation catalog level. According to the method and the device, the current du data list consisting of the du data to be subjected to catalog separation is constructed, absolute path information corresponding to each du data of the list is obtained, absolute paths of any one current du data in the list are compared by using the absolute path information, and the containing relation between the absolute paths corresponding to the last du data of the du data is used, so that the current du data can be written into the first sub-du data list under the condition that the absolute paths corresponding to the last du data do not contain the absolute paths of the current du data, and when catalog separation turns meet the separation catalog level, the separated first sub-du data list is used as the separation catalog list, and therefore catalog separation is achieved.
In an exemplary embodiment, as shown in fig. 2, step S102 may further include:
step S201, a first pointer value of a first pointer associated with the current du data is obtained, and second absolute path information is assigned to a second pointer; the first pointer value is used to store first absolute path information.
In this embodiment, the first absolute path information and the second absolute path information associated with the current du data may be stored by two pointers, where the first pointer is a pointer for storing the first absolute path information, for example, a previous pointer, and the second pointer may be a pointer for storing the second absolute path information, for example, a current pointer.
Specifically, the terminal may obtain the path information inclusion relationship between the first absolute path information and the second absolute path information associated with the current du data by setting two pointers, where the first pointer value may store the first absolute path information of the current du data in advance, and then, after obtaining the absolute path information corresponding to the current du data, that is, the associated second absolute path information, the terminal may assign the second absolute path information to the second pointer.
Step S202, obtaining a path information inclusion relationship according to the pointer value inclusion relationship between the first pointer value and the second pointer value of the second pointer.
Because the first pointer value already stores the first absolute path information associated with the current du data at this time, and the pointer value of the second pointer, namely the second pointer value, stores the second absolute path information associated with the current du data, the path information inclusion relationship between the first absolute path information and the second absolute path information can be represented by the inclusion association between the first pointer value and the second pointer value.
In this embodiment, the terminal may store the first absolute path information and the second absolute path information through the first pointer and the second pointer, that is, through the two pointers, the obtaining of the address information inclusion relationship is achieved, so that the obtaining efficiency of the address information inclusion relationship may be further improved.
Further, after step S202, the method may further include: assigning the second pointer value to the first pointer to obtain an updated first pointer; the updated first pointer is used for storing first absolute path information associated with the next du data of the current du data in the current du data list.
After the address information containing relation of the current du data is obtained, because the absolute path information corresponding to the last du data of the current du data is stored in the current first pointer value, if the next du data of the current du data needs to be obtained, the containing relation of the path information can also be obtained by using the first pointer and the second pointer, the terminal needs to assign the current second pointer value to the first pointer to obtain the updated first pointer, the absolute path information corresponding to the current du data can be stored in the first pointer value of the updated first pointer at this time, and when the path information containing relation of the next du data of the current du data is obtained, because the first pointer value is the absolute path information of the current du data at this time, the absolute path information corresponding to the next du data can be obtained for the next du data of the current du data, the absolute path information corresponding to the next du data is represented at this time, and the absolute path information corresponding to the next du data can be updated by using the second pointer, and the absolute path information corresponding to the second pointer can be realized by using the updated absolute path information corresponding to the second pointer value.
In this embodiment, after the acquisition of the path information containing relationship corresponding to the current du data is completed, the second pointer value may be assigned to the first pointer, so that the path information containing relationship corresponding to all du data in all the current du data lists is obtained by using the two pointers, and the acquisition convenience of the path information containing relationship is further improved.
In addition, in the case where the current du data is the first du data in the current du data list, before step S201, the method may further include: the first pointer value of the first pointer and the second pointer value of the second pointer are set to null values.
If the current du data is the first du data in the current du data list, that is, if the first data in the current du data list has no pointer value, then in order to enable the directory separation process to be smoothly executed, the terminal may perform null value processing on the pointer values of the first pointer and the second pointer, that is, set the first pointer value and the second pointer value to null values.
In this embodiment, if the current du data is the first du data in the current du data list, the terminal may further set the first pointer value and the second pointer value to null values, so that smooth execution of directory separation may be ensured, and thus the running stability of directory separation may be further improved.
In one embodiment, after step S102, the method may further include: if the path information contains the relation representation first absolute path information and contains second absolute path information, writing the current du data into a second sub du data list corresponding to the current du data list; after step S104, the method may further include: in the case that the catalog separation round does not reach the target separation round, the second sub du data list is taken as a new current du data list, and the step S101 is executed back until the catalog separation round reaches the target separation round.
The second du data list refers to a du data list formed by remaining du data after the first du data list is separated from the current du data list, and because the du data included in the first du data list is du data that does not include the second absolute path information in the associated first absolute path information, the du data forming the second du data list is du data that includes the second absolute path information in the associated first absolute path information.
Specifically, if the path information includes the relation characterizing the first absolute path information and the second absolute path information is included in the first absolute path information, the terminal may write the current du data into the second sub-du data list. After completing the catalog separation of all the du data in the current du data list, if the catalog separation round does not reach the target separation round, the terminal may return to obtain the absolute path information again with the second sub-du data list as a new current du data list, and execute the step of implementing the catalog separation by using the inclusion relationship between the absolute path information until the catalog separation round reaches the target separation round.
For example, if the directory to be separated is a secondary directory, the preset separation directory level may be 2 levels, if the current directory separation round is 1 time, and the target separation round matched with the separation directory level is not reached, at this time, after the terminal completes the first directory separation to form the first sub-du data list and the second sub-du data list, the terminal may use the remaining second sub-du data list including the secondary directory and the du data of other high-level directories as a new current du data list, and execute the directory separation operation again, after completing the second directory separation again, because the separation directory level has been reached, the terminal may use the first sub-du data list obtained by the second separation as the finally separated secondary directory list.
In this embodiment, the terminal may further generate a second sub-du data list, and the second sub-du data list may be used as a new current du data list when the directory splitting round does not reach the target splitting round.
In one embodiment, as shown in fig. 3, step S101 may further include:
in step S301, in response to a command initiated by the target account for checking the disk usage, corresponding du data is obtained, and the corresponding du data is stored in a text document associated with the target account.
Wherein. The target account is a user account triggering a command for viewing disk usage, and the text document associated with the target account refers to a text document corresponding to the target account, for example, a txt document named by the account name of the target account. In this embodiment, du data may be stored in txt files named by users, and du data obtained by different users may be stored in different txt files.
In step S302, the text document is read into the memory, and a du data list matched with the text document is generated as the current du data list.
After the terminal finishes the storage of the du data, the txt file of the user can be further read, the text file is read into the memory and stored in a list of the memory, so that a du data list is obtained, and the du data list is used as a first catalog to separate the corresponding current du data list.
In this embodiment, the terminal may store the corresponding du data into the text document corresponding to the user in response to the command for checking the use condition of the disk, and may also form the current du data list by reading the text document into the memory.
Further, the current du data list also stores the catalog capacity of the catalog represented by each du data; step S103 may further include: writing the current du data and the catalog capacity corresponding to the current du data into a first sub-du data list; as shown in fig. 4, after step S104, the method may further include:
in step S401, the directory capacity corresponding to each du data included in the split directory list is acquired.
The directory capacity refers to capacity information of a corresponding directory of du data, and in this embodiment, the data format of the extracted du data is the file size of the corresponding directory, that is, the capacity information, the operation date of the directory, and the absolute path information, so that in forming the current du data list, the capacity information of each du data may also be stored. And then constructing a first sub-du data list, and writing the capacity information of the current du data into the first sub-du data list in addition to the current du data, so that in the formed separated directory list, the terminal can obtain the directory capacity corresponding to each du data.
Step S402, sorting all du data contained in the separated directory list according to directory capacity, and storing the pre-preset number of du data with the largest directory capacity in all du data contained in the separated directory list into a result path file;
step S403, the result path file is subjected to visual display processing.
After the catalog capacity of each du data in the separated catalog list is obtained, the du data in the separated catalog list can be sorted according to the catalog capacity, for example, the du data can be sorted according to the order of the catalog capacity from large to small, and the former preset number of du data with the largest catalog capacity in the du data can be stored in the result path file, for example, the first n du data with the largest capacity can be stored in the result path file, and visual display is performed, so that the user can quickly locate the catalog with larger occupied capacity, for example, locate the large file, the secondary catalog with larger capacity, and the like.
In this embodiment, the terminal may further implement screening of the large-capacity directory according to the directory capacity corresponding to each du data, and visually display the large-capacity directory, thereby further improving the intelligence of directory analysis.
In one embodiment, a method for statistical analysis of files and directories is also provided, which can extract du data of a user when storage is idle, then separate files, secondary directories including only files and high-level directories using an algorithm based on the du data, and locate large files and secondary directories including only files by a sorting algorithm. The method can improve the query efficiency and can not invade the file system. In the method, du data is stored in txt files named by users, different users are stored in different txts, as shown in fig. 5, and the method specifically comprises the following steps:
(1) And acquiring du data of the user, wherein the data are in the format of file size, operation date and absolute path.
(2) The text document file is read. And reading the text document into a memory, and storing the text document in a du data list.
(3) And assigning values to the first pointer and the second pointer of the pointer variable, wherein the default value is null. And acquiring the first line data of the list, acquiring the path information of the first line data after splitting the first line data, and assigning the path information to the second pointer.
(4) It is determined whether the first pointer value contains the second pointer value. If not, the second pointer value, the corresponding file/directory size and date are stored in a first sub du data list; if so, it is saved in the second sub du data list. The second pointer is then assigned to the first pointer.
(5) And judging whether the du data list has the next piece of data. If yes, acquiring the next piece of data, acquiring address information of the next piece of data after splitting, assigning the address to a second pointer, and jumping to the step 4. Until all list data is fetched.
(6) And acquiring the large file of the top N of the user ranking. And acquiring a first sub du data list value, arranging in descending order according to the size of the catalog, acquiring file information of N names before the user ranks, and storing the result into a corresponding file under a result path, wherein the format of the result file is the size, the operation date and the absolute path.
(7) A second list of sub du data is obtained. And (3) - (5) are carried out on the second sub du data list again to obtain a first sub du data list of the secondary catalog.
(8) A top N user ranking secondary directory containing only files is obtained. And (3) arranging the first sub du data list obtained in the step (7) in a descending order according to the size of the catalog, obtaining a secondary catalog which only comprises files and is ranked N before under a user name, and storing the result into a corresponding file under a result path, wherein the format of the result file is the size, the operation date and the absolute path.
(9) And storing the obtained result file into a database.
(10) It is visualized using front-end presentation techniques.
By the embodiment, the large files and the secondary directory only comprising the files can be positioned under the condition of not invading the file system, and the searching efficiency can be improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a catalog separation apparatus for implementing the catalog separation method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the directory splitting device provided below may refer to the limitation of the directory splitting method described above, and will not be repeated here.
In one embodiment, as shown in fig. 6, there is provided a catalog splitting apparatus comprising: the du list obtaining module 601, the path includes obtaining module 602, the sub du list obtaining module 603 and the split directory obtaining module 604, wherein:
the du list obtaining module 601 is configured to obtain a current du data list composed of du data to be separated from a directory, and obtain absolute path information corresponding to each du data in the current du data list; the du data is obtained by executing a command for checking the use condition of the disk;
the path containing acquiring module 602 is configured to acquire, for any one of the current du data in the current du data list, a path information containing relationship between first absolute path information and second absolute path information associated with the current du data; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data;
a sub du list obtaining module 603, configured to write current du data into a first sub du data list corresponding to the current du data list if the inclusion relation indicates that the first absolute path information does not include the second absolute path information;
The split directory obtaining module 604 is configured to obtain a directory split round corresponding to the current du data list, and use the first sub du data list as a split directory list matched with a split directory level when the directory split round reaches a target split round matched with a preset split directory level.
In one embodiment, the path includes an acquisition module 602, further configured to acquire a first pointer value of a first pointer associated with the current du data and assign second absolute path information to the second pointer; the first pointer value is used for storing first absolute path information; and obtaining the path information inclusion relationship according to the pointer value inclusion relationship between the first pointer value and the second pointer value of the second pointer.
In one embodiment, the path includes an obtaining module 602, further configured to assign the second pointer value to the first pointer, to obtain an updated first pointer; the updated first pointer is used for storing first absolute path information associated with the next du data of the current du data in the current du data list.
In one embodiment, the path includes an acquisition module 602 that is further configured to set a first pointer value of the first pointer and a second pointer value of the second pointer to null values.
In one embodiment, the sub-du list obtaining module 603 is further configured to, if the path information includes the second absolute path information included in the first absolute path information, write the current du data into a second sub-du data list corresponding to the current du data list; the separate directory obtaining module 604 is further configured to, in a case where the directory separation round does not reach the target separation round, take the second sub du data list as a new current du data list, and return to executing the step of obtaining absolute path information corresponding to each du data in the current du data list until the directory separation round reaches the target separation round.
In one embodiment, the du list obtaining module 601 is further configured to obtain corresponding du data in response to a command initiated by the target account for checking a disk usage situation, and store the corresponding du data in a text document associated with the target account; and reading the text document into the memory, and generating a du data list matched with the text document as a current du data list.
In one embodiment, the current du data list also stores the directory capacity of the directory characterized by each du data; the sub du list obtaining module 603 is further configured to write the current du data and a directory capacity corresponding to the current du data into the first sub du data list; the catalog separating apparatus further comprises: the result file display module is used for acquiring the catalog capacity corresponding to each du data contained in the separated catalog list; sorting all du data contained in the separated directory list according to the directory capacity, and storing the pre-preset number of du data with the largest directory capacity in all du data contained in the separated directory list into a result path file; and carrying out visual display processing on the result path file.
The various modules in the catalog splitting apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one exemplary embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 7. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a directory splitting method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use, and processing of the related data are required to meet the related regulations.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric RandomAccess Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can take many forms, such as static Random access memory (Static Random Access Memory, SRAM) or Dynamic Random access memory (Dynamic Random AccessMemory, DRAM), among others. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A directory splitting method, the method comprising:
acquiring a current du data list consisting of du data to be subjected to catalog separation, and acquiring absolute path information corresponding to each du data in the current du data list; the du data is obtained by executing a command for checking the use condition of the disk;
acquiring a path information inclusion relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data; the obtaining the path information containing relation between the first absolute path information and the second absolute path information associated with the current du data includes: acquiring a first pointer value of a first pointer associated with the current du data, and assigning the second absolute path information to a second pointer; the first pointer value is used for storing the first absolute path information; obtaining the path information inclusion relationship according to the pointer value inclusion relationship between the first pointer value and the second pointer value of the second pointer;
If the inclusion relation characterizes that the first absolute path information does not contain the second absolute path information, writing the current du data into a first sub du data list corresponding to the current du data list;
and acquiring a catalog separation round corresponding to the current du data list, and taking the first sub-du data list as a separation catalog list matched with a preset separation catalog level under the condition that the catalog separation round reaches a target separation round matched with the separation catalog level.
2. The method of claim 1, wherein after the obtaining the path information inclusion relationship, further comprising:
assigning the second pointer value to the first pointer to obtain an updated first pointer; the updated first pointer is used for storing first absolute path information associated with the next du data of the current du data in the current du data list.
3. The method of claim 1, wherein, in the case where the current du data is a first du data in the current du data list, the acquiring a first pointer value of a first pointer associated with the current du data is preceded by:
And setting a first pointer value of the first pointer and a second pointer value of the second pointer to be null values.
4. A method according to any one of claims 1 to 3, wherein after the obtaining the path information inclusion relationship between the first absolute path information corresponding to the du data that is the last one of the current du data in the current du data list and the second absolute path information corresponding to the current du data, the method further includes:
if the path information containing relation characterizes that the first absolute path information contains the second absolute path information, writing the current du data into a second sub du data list corresponding to the current du data list;
after the catalog separation round corresponding to the current du data list is obtained, the method further comprises the following steps:
and under the condition that the catalog separation round does not reach the target separation round, taking the second sub du data list as a new current du data list, and returning to execute the step of acquiring absolute path information corresponding to each du data in the current du data list until the catalog separation round reaches the target separation round.
5. The method of claim 1, wherein the obtaining a current du data list consisting of du data to be directory split comprises:
Responding to a command initiated by a target account for checking the use condition of a disk, acquiring corresponding du data, and storing the corresponding du data into a text document associated with the target account;
and reading the text document into a memory, and generating a du data list matched with the text document as the current du data list.
6. The method of claim 5, wherein the current du data list further stores a directory capacity of a directory characterized by each of the du data;
writing the current du data into a first sub-du data list corresponding to the current du data list, and further including:
writing the current du data and the directory capacity corresponding to the current du data into the first sub-du data list;
after the first subdu data list is used as the separated directory list matched with the separated directory hierarchy, the method further comprises the following steps:
acquiring catalog capacity corresponding to each du data contained in the separated catalog list;
sorting all du data contained in the separated directory list according to the directory capacity, and storing the pre-preset number of du data with the largest directory capacity in all du data contained in the separated directory list into a result path file;
And carrying out visual display processing on the result path file.
7. A catalog splitting apparatus, the apparatus comprising:
the du list acquisition module is used for acquiring a current du data list consisting of du data to be subjected to directory separation and acquiring absolute path information corresponding to each du data in the current du data list; the du data is obtained by executing a command for checking the use condition of the disk;
the path containing acquisition module is used for acquiring a path information containing relation between first absolute path information and second absolute path information associated with the current du data aiming at any current du data in the current du data list; the first absolute path information is absolute path information corresponding to the last du data of the current du data in the current du data list, and the second absolute path information is absolute path information corresponding to the current du data; the method is further used for acquiring a first pointer value of a first pointer associated with the current du data and assigning the second absolute path information to a second pointer; the first pointer value is used for storing the first absolute path information; obtaining the path information inclusion relationship according to the pointer value inclusion relationship between the first pointer value and the second pointer value of the second pointer;
A sub-du list obtaining module, configured to write the current du data into a first sub-du data list corresponding to the current du data list if the inclusion relation indicates that the first absolute path information does not include the second absolute path information;
the separation catalog acquisition module is used for acquiring catalog separation rounds corresponding to the current du data list, and taking the first sub du data list as a separation catalog list matched with a preset separation catalog level under the condition that the catalog separation rounds reach the target separation rounds matched with the separation catalog level.
8. The apparatus of claim 7, wherein a path comprises an acquisition module further configured to assign the second pointer value to the first pointer, resulting in an updated first pointer; the updated first pointer is used for storing first absolute path information associated with the next du data of the current du data in the current du data list.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311569042.2A 2023-11-23 2023-11-23 Directory separation method, apparatus, computer device and storage medium Active CN117290302B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311569042.2A CN117290302B (en) 2023-11-23 2023-11-23 Directory separation method, apparatus, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311569042.2A CN117290302B (en) 2023-11-23 2023-11-23 Directory separation method, apparatus, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN117290302A CN117290302A (en) 2023-12-26
CN117290302B true CN117290302B (en) 2024-02-06

Family

ID=89240979

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311569042.2A Active CN117290302B (en) 2023-11-23 2023-11-23 Directory separation method, apparatus, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN117290302B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108268609A (en) * 2017-12-29 2018-07-10 新浪网技术(中国)有限公司 A kind of foundation of file path, access method and device
WO2021003932A1 (en) * 2019-07-05 2021-01-14 平安国际智慧城市科技股份有限公司 File management method and apparatus, computer device and storage medium
WO2023036005A1 (en) * 2021-09-08 2023-03-16 华为技术有限公司 Information processing method and apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108268609A (en) * 2017-12-29 2018-07-10 新浪网技术(中国)有限公司 A kind of foundation of file path, access method and device
WO2021003932A1 (en) * 2019-07-05 2021-01-14 平安国际智慧城市科技股份有限公司 File management method and apparatus, computer device and storage medium
WO2023036005A1 (en) * 2021-09-08 2023-03-16 华为技术有限公司 Information processing method and apparatus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于目录数据分离存储的文件存储方法的研究与实现;何文才;郑钊;刘培鹤;杜敏;;网络安全技术与应用(第01期);全文 *

Also Published As

Publication number Publication date
CN117290302A (en) 2023-12-26

Similar Documents

Publication Publication Date Title
US20200226133A1 (en) Knowledge map building system and method
WO2021003932A1 (en) File management method and apparatus, computer device and storage medium
CN102004752A (en) Flexible cube data warehousing
CN114115844A (en) Page generation method and device, computer equipment and storage medium
CN106648569B (en) Target serialization realization method and device
CN114756627B (en) Alliance-chain-based digital asset processing method, system and storage medium
JP2010518514A (en) System and method for displaying and navigating content on an electronic device
CN114328983A (en) Document fragmenting method, data retrieval device and electronic equipment
CN117290302B (en) Directory separation method, apparatus, computer device and storage medium
CN117112941A (en) Dictionary acquisition method, dictionary acquisition device, computer device, storage medium, and program product
JP2010160577A (en) Retrieving device, control method therefor, and computer program
CN114924911A (en) Method, device, equipment and storage medium for backing up effective data of Windows operating system
CN114416676A (en) Data processing method, device, equipment and storage medium
CN112835886A (en) Data table field adding method and device
US9323753B2 (en) Method and device for representing digital documents for search applications
CN117435589A (en) Data transfer method, device, computer equipment and storage medium
CN116821102B (en) Data migration method, device, computer equipment and storage medium
CN115357559A (en) Data migration method and device, computer equipment and storage medium
CN114610688A (en) Log aggregation method and device, computer equipment and storage medium
CN117909550A (en) Query method, query device, computer equipment and storage medium
JP2006172363A (en) Document retrieval device, index reconfiguration method and program
CN114647630A (en) File synchronization method, information generation method, file synchronization device, information generation device, computer equipment and storage medium
CN115376660A (en) Image searching method and computer program product
CN117033451A (en) Searching method, searching device, computer equipment and storage medium
CN116894123A (en) User characteristic acquisition method for content search, music search method and equipment

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
GR01 Patent grant
GR01 Patent grant