CN111209159A - Information processing method, device, equipment and storage medium - Google Patents

Information processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN111209159A
CN111209159A CN201911408766.2A CN201911408766A CN111209159A CN 111209159 A CN111209159 A CN 111209159A CN 201911408766 A CN201911408766 A CN 201911408766A CN 111209159 A CN111209159 A CN 111209159A
Authority
CN
China
Prior art keywords
file
information
directory
current
directory file
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
CN201911408766.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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN201911408766.2A priority Critical patent/CN111209159A/en
Publication of CN111209159A publication Critical patent/CN111209159A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3072Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides an information processing method, an information processing device, information processing equipment and a storage medium, wherein the method comprises the following steps: acquiring first request information for counting the number of directory files, wherein the first request information carries first directory identification information; acquiring a first directory file corresponding to the first directory identification information; traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file; determining file quantity information contained in the first directory file based on the file content information traversal result; and outputting the file number information contained in the first directory file. According to the method and the device, the traversing efficiency of the directory file can be improved, the traversing time and the resource consumption are reduced, and therefore the monitoring requirements of the directory and the file thereof in a large data center are met.

Description

Information processing method, device, equipment and storage medium
Technical Field
The present application belongs to the field of computer technologies, and in particular, to an information processing method, apparatus, device, and storage medium.
Background
In the operation management of a large-scale data center, the problems that the reading and writing time delay of files under a directory is increased, the transaction processing time is prolonged and the like due to too many files under a single directory (especially a file transmission application system) often occur. When the number of contexts in a single directory is accumulated to a million level, serious problems of incapability of normally accessing the directory, overtime transaction, reduction of system success rate, even application ramming and the like occur, and further serious business influence is generated.
In order to find the problem and risk of excessive accumulation of the directory files in the system operation and maintenance in time, the directory files need to be monitored and regularly checked. In the prior art, a directory file system is usually monitored by using a command or a script carried by an operating system, but the monitoring method has the problems of low statistical efficiency, long consumed time, large resource consumption, poor flexibility, difficulty in writing scripts when performing classified statistics or statistics of multiple directory levels and the like, and cannot meet the monitoring requirements of a large-scale data center on directories and files thereof.
Disclosure of Invention
In order to improve the efficiency of directory file traversal and reduce traversal time and resource consumption, and thus meet the monitoring requirements of a large-scale data center on directories and files thereof, the application provides an information processing method, an information processing device, information processing equipment and a storage medium.
In one aspect, the present application provides an information processing method, including:
acquiring first request information for counting the number of directory files, wherein the first request information carries first directory identification information;
acquiring a first directory file corresponding to the first directory identification information;
traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file;
determining file quantity information contained in the first directory file based on the file content information traversal result;
and outputting the file number information contained in the first directory file.
Further, the traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file includes:
acquiring file content information of the first directory file;
reading index information of subfiles contained in the first directory file from file content information of the first directory file;
taking the read index information of the subfile as the traversal result of the file content information;
correspondingly, the determining the file number information contained in the first directory file based on the file content information traversal result includes:
and counting the read index information of the subfiles to obtain the file quantity information contained in the first directory file.
Further, the file content information of the first directory file is traversed to obtain a file content information traversal result corresponding to the first directory file; determining the file quantity information contained in the first directory file based on the file content information traversal result, further comprising:
opening the first directory file;
counting the file number information as 0;
taking the first directory file as a first current directory file;
acquiring file content information of the first current directory file;
taking any subfile in the first current directory file as a first current subfile;
reading the index information of the first current subfile from the file content information of the first current directory file, and adding 1 to the file quantity information in an accumulated manner;
if the subfiles in the first current directory file are not completely traversed or the file quantity information is smaller than a preset threshold value, taking the directory file formed by other files except the first current subfile in the first current directory file as the first current directory file again;
and repeating the step of taking any subfile in the first current directory file as the first current subfile until each subfile in the directory file is traversed or the file number information is greater than or equal to the preset threshold value.
Further, after the file number information is greater than or equal to the preset threshold, the method further includes: and sending out alarm prompt information.
Further, the method further comprises:
acquiring second request information for counting the directory file type and/or the directory file size, wherein the second request information carries second directory identification information;
acquiring a second directory file corresponding to the second directory identification information;
opening the second directory file;
taking the second directory file as a second current directory file;
acquiring file content information of the second current directory file;
taking any subfile in the second current directory file as a second current subfile;
reading the index information of the second current subfile from the file content information of the second current directory file;
reading file header information of the second current subfile according to the index information of the second current subfile to obtain attribute information of the second current subfile;
determining statistical information corresponding to the second request information according to the index information of the second current subfile and the attribute information of the second current subfile;
if the second current subfile is not a directory file and does not meet the preset traversal level information, the directory file formed by other files except the second current subfile in the second current directory file is used as the second current directory file again;
repeating the step of taking any subfile in the second current directory file as a second current subfile until all subfiles corresponding to the preset traversal level information are traversed;
and if the second current subfile is a directory file and meets the preset traversal level information, the second current subfile is used as the second directory file again, and the step of opening the current directory file is repeated until each subfile in the preset traversal level information is traversed.
Further, after the files corresponding to the preset traversal level information are traversed, the method further includes: and outputting the statistical information corresponding to the second request information.
In another aspect, the present application provides an information processing apparatus, including:
the system comprises a first request information acquisition module, a first storage module and a second storage module, wherein the first request information acquisition module is used for acquiring first request information for counting the number of directory files, and the first request information carries first directory identification information;
the first directory file acquisition module is used for acquiring a first directory file corresponding to the first directory identification information;
the traversal result acquisition module is used for traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file;
the file quantity information determining module is used for determining the file quantity information contained in the first directory file based on the file content information traversal result;
and the output module is used for outputting the file quantity information contained in the first directory file.
Further, the traversal result obtaining module includes:
a file content information acquiring unit configured to acquire file content information of the first directory file;
an index information reading unit configured to read index information of a subfile included in the first directory file from file content information of the first directory file;
and the traversal result determining unit is used for taking the read index information of the subfile as the traversal result of the file content information.
In another aspect, the present application provides an electronic device, which includes a processor and a memory, where at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded by the processor and executed to implement the information processing method as described above.
In another aspect, the present application provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded by a processor and implements the information processing method as described above.
According to the information processing method, the information processing device, the information processing equipment and the information processing storage medium, different request information is obtained through different parameters input by a user, and application functions under different scenes are achieved. Such as: when the file quantity information of a certain directory file is counted, only the file content information of the directory file needs to be read, and the related information (such as file header information of subfiles) of the file under the directory does not need to be read, so that the Input/Output (IO) quantity is effectively reduced, the efficiency and flexibility of directory file traversal are improved, invalid information reading and resource waste are avoided, and the requirement of a large-scale data center for monitoring the directory and the files is met.
Drawings
In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic diagram of an implementation environment of an information processing method according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of an information processing method according to an embodiment of the present application.
Fig. 3 is a schematic flowchart of another information processing method according to an embodiment of the present application.
Fig. 4 is a schematic flowchart of another information processing method according to an embodiment of the present application.
Fig. 5 is a schematic flowchart of another information processing method according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of an information processing apparatus according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic diagram of an implementation environment of an information processing method according to an embodiment of the present application. As shown in fig. 1, the implementation environment may include at least: the device comprises a main control module 01, a traversal module 02, a statistic module 03 and an output module 04.
Specifically, the main control module 01 may be configured to control a main process, and select different processes for processing according to different input parameters.
Specifically, the traversal module 02 may be configured to implement a directory traversal function, and call a statistics module as needed to complete relevant statistics.
Specifically, the statistical module 03 may be configured to implement a relevant statistical function, such as performing summary statistics according to types, sizes, and the like.
Specifically, the output module 04 may be configured to output the relevant information according to a user requirement.
It should be noted that fig. 1 is only an example.
Fig. 2 is a schematic flow chart of an information processing method provided in an embodiment of the present application, and the present specification provides the method operation steps as described in the embodiment or the flowchart, but more or less operation steps may be included based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system or server product may be implemented in a sequential or parallel manner (e.g., parallel processor or multi-threaded environment) according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 2, the method may include:
s101, first request information for counting the number of directory files is obtained, and the first request information carries first directory identification information.
In the embodiment of the application, when a user needs to monitor the number of files in a certain directory, parameters related to the number of statistical directory files can be input at a terminal to form corresponding request information, and the request information carries identification information or path information of the directory files needing to be traversed.
S103, acquiring a first directory file corresponding to the first directory identification information.
In the embodiment of the application, after the first request information is obtained, the corresponding first directory file can be found according to the first directory identification information carried in the request information, where the first directory file is a directory of the number of directory files to be counted.
And S105, traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file.
In this embodiment of the application, as shown in fig. 3, S105 may include:
s1051, obtaining the file content information of the first directory file.
S1053, reading the index information of the subfiles contained in the first directory file from the file content information of the first directory file.
And S1055, taking the read index information of the subfiles as the traversal result of the file content information.
S107, determining the file quantity information contained in the first directory file based on the file content information traversal result.
In this embodiment of the application, as shown in fig. 3, S107 may include:
and counting the read index information of the subfiles to obtain the file quantity information contained in the first directory file.
In the embodiment of the application, only the index information of the subfiles in the file content information of the directory file is read, and the read index information is counted, so that the file quantity information contained in the first directory file can be obtained, and the related information (such as file header information of the subfiles) of the files under the first directory file does not need to be read one by one, so that reading of invalid information is avoided, the IO (input/output) quantity is reduced, the traversal efficiency of the directory file is greatly improved, the monitoring on the second level or even the millisecond level of the file quantity under a certain directory is realized, and the monitoring requirements of a large-scale data center on the directory and the files thereof are met.
And S109, outputting the file quantity information contained in the first directory file.
In the embodiment of the present application, after obtaining the file number information, the file number information may be output to return the file number information to the user, where the output mode includes, but is not limited to, outputting the counted file number information to a screen or outputting the counted file number information to a file.
In the following, as shown in fig. 4, taking an application scenario as a linux environment (linux is a set of operating systems free of use and free of propagation), a specific process for monitoring the quantity of pieces in a certain directory in the linux environment is described in detail:
s201, a user inputs a parameter for counting the number of files in a certain directory file at a terminal to form first request information for counting the number of the directory files, wherein the first request information carries first directory identification information.
S203, responding to the first request information, and acquiring a first directory file corresponding to the first directory identification information.
S205, opening the first directory file.
And S207, counting the file quantity information as 0.
In practical application, a quantity counter may be set, and when the first directory file is opened for the first time, the quantity counter is set to 0.
S209, the first directory file is used as a first current directory file.
And S2011, acquiring the file content information of the first current directory file.
S2013, any subfile in the first current directory file is used as a first current subfile.
In practical application, because the directory file may include a plurality of subfiles, any one of the subfiles may be traversed as a first current subfile during traversal, and certainly, each subfile may also be sequentially traversed according to a directory structure of the first directory file.
And S2015, reading the index information of the first current subfile from the file content information of the first current directory file, and adding 1 to the file quantity information in an accumulated mode.
In practical application, the file content information of the first current directory file stores the index information of the subfiles, that is, the index information corresponds to the number of the subfiles one by one, so that the number of the number counter can be added by 1 every time one index information is read.
In practical applications, the index information of the subfile may be information characterizing the positioning of the subfile to a certain position on the hard disk.
S2017, if the subfiles in the first current directory file are not completely traversed or the file quantity information is smaller than a preset threshold value, taking the directory file formed by other files except the first current subfile in the first current directory file as the first current directory file again.
S2019, the step of taking any subfile in the first current directory file as the first current subfile is repeated until each subfile in the directory file is traversed or the file quantity information is larger than or equal to the preset threshold value.
In practical application, whether the subfiles in the first current directory file are completely traversed or whether the file quantity information is greater than or equal to a preset threshold value is monitored in real time, if the subfiles in the first current directory file are not completely traversed or the file quantity information is less than the preset threshold value, the step returns to S2011 for re-traversing so as to read the index information of the next subfile, and if each subfile in the directory file is traversed or the file quantity information is greater than or equal to the preset threshold value, the step returns the file quantity information contained in the first directory file obtained through statistics.
In a feasible embodiment, when the number of the counted files is greater than or equal to a preset threshold (for example, 100 ten thousand), an alarm prompt message can be sent, and an output result is automatically returned when the number of the files is counted to the preset threshold, the result is output without waiting for the completion of all traversals of each subfile in the directory file, the method has the characteristics that the required information is returned after being read, and all traversals are not required, the flexible control can be realized according to different service scenes, the resource waste and the acquisition of invalid information are avoided, and the traversal efficiency is improved.
S101 to S109 and S201 to S2019 provided in the embodiments of the present application may be understood as counting the total number of files in a certain directory file. In some feasible embodiments, statistics of files under a certain directory file according to different conditions such as hierarchy and type can be realized according to different parameters input by a user, and related information such as quantity, size, type, authority, access time and the like can be returned according to requirements.
Specifically, as shown in fig. 5, the method may further include:
s301, second request information for counting the directory file type and/or the directory file size is obtained, and the second request information carries second directory identification information.
In practical application, when a user needs to count the number of files of various types (including common files, directories, link files, pipeline files, and the like) in a certain directory file, different parameters can be input in a terminal to form corresponding request information. For example: inputting "-type REG", and characterizing to count the common files; inputting "-type DIR", representing and counting the directory files; and performing deep traversal on the main directory according to input parameters, such as inputting "-level 1", representing that only files under the current main directory are traversed, inputting "-level all", representing that files of all hierarchical directories under the main directory are traversed, and performing sub-directory statistics.
In practical application, when a user needs to count the file size of a certain directory file, corresponding parameters can be input at a terminal, for example, when the user needs to count the size of a common file of the certain directory file, deep traversal statistics can be performed on a main directory according to the input parameters.
In practical application, the second request message may represent request information for counting the directory file type and/or the directory file size, and may also represent other types of request information, such as request information for counting file creation time, access authority, and the like, that is, may also list names of various types of files under a certain directory file according to parameters (e.g., ls command) input by a user, and may respectively show information such as file size, creation time, access authority, read-write authority, and the like according to different input parameters.
And S303, acquiring a second directory file corresponding to the second directory identification information.
S305, opening the second directory file.
And S307, taking the second directory file as a second current directory file.
S309, acquiring file content information of the second current directory file.
And S3011, taking any subfile in the second current directory file as a second current subfile.
And S3013, reading the index information of the second current subfile from the file content information of the second current directory file.
In practical applications, S303-S3013 are similar to S203-S2015, and are not described herein again.
S3015, according to the index information of the second current subfile, reading file header information of the second current subfile to obtain attribute information of the second current subfile.
In practical application, if the subfiles corresponding to the preset traversal level information are not completely traversed, the file header information of the second current subfile can be read, so as to obtain attribute information related to the subfile, wherein the attribute information includes but is not limited to type information, size information, access authority information, read-write authority information, name, creation time and the like of the second current subfile. The preset traversal level information may be obtained by a user inputting parameters in advance at the terminal, for example, if the user needs to traverse the third-level of the second directory file, parameters related to the third-level traversal may be input at the terminal in advance.
S3017, determining statistical information corresponding to the second request information according to the index information of the second current subfile and the attribute information of the second current subfile.
In practical applications, different statistical information may be determined as needed according to the type of the second request information.
For example, if the second request information is request information requesting a directory file type, the type of the second current subfile may be obtained from attribute information of the second current subfile (the size may not be counted when the type is counted), the type of the second current subfile is used as statistical information, if the number of the subfiles of different types further needs to be counted, the number of the subfiles of different types may be determined according to the accessed index information, and the type of the second current subfile and the number information of the subfiles of the type are used as statistical information, and a specific file number statistical process is similar to S2015 and is not described herein again.
For another example, if the second request information is request information requesting the size of a directory file, the size of the second current subfile may be obtained from the attribute information of the second current subfile (when the size is counted, the type may not be counted), and the size of the second current subfile is used as the statistical information.
For another example, if the second request information is request information requesting a size and a type of a directory file, the size and the type of the second current subfile may be obtained from attribute information of the second current subfile, and the size and the type of the second current subfile may be used as statistical information.
And S3019, if the second current sub-file is not a directory file and does not meet the preset traversal level information, taking a directory file formed by other files except the second current sub-file in the second current directory file as the second current directory file again.
And S30111, repeating the step of taking any subfile in the second current directory file as a second current subfile until all subfiles corresponding to the preset traversal level information are traversed.
S30113, if the second current subfile is a directory file and meets the preset traversal level information, the second current subfile is used as the second directory file again, and the step of opening the current directory file is repeated until each subfile in the preset traversal level information is traversed.
In practical applications, since the subfiles under the directory file may include normal files, directory files, link files, pipe files, and the like. Therefore, in the process of traversing the second current subfile, it is necessary to determine whether the second current subfile is a directory file and meets preset traversal level information. If the above two conditions are not satisfied, the process may return to S309 to continue reading the index information of the next subfile. If both of the above conditions are satisfied, indicating that the second current subfile is a directory file, at this point, the directory file may be regarded as the second directory file again, and the process returns to S305 to continue the recursive traversal of the second directory file determined again.
S30115, if each subfile in the preset traversal level information is traversed, outputting statistical information corresponding to the second request information.
In practical applications, after the second directory file is traversed, the statistical information corresponding to the second request may be outputted. The statistical information may be directly output to the screen, or a mode of returning the statistical information may be selected according to the parameter input by the user, for example, if the parameter input by the user is "-o file", the statistical information may be output to a file.
In practical applications, the statistical information may be information such as a file name, creation time, access right, read-write right, etc., in addition to information related to the number of files, file types, and file sizes, and accordingly, a user is required to input parameters corresponding to information such as the file name, creation time, access right, read-write right, etc., which is obtained at a terminal in advance.
In the embodiment of the application, the application functions of different scenes can be realized by inputting different parameters through a user, and the flexibility is improved on the premise of ensuring the efficiency. Flexible statistics can be performed according to different service requirements, and large and full calculation is avoided, for example, if only type and quantity information needs to be counted, size calculation is not performed (the size calculation is a double type, and the performance overhead is high); if only the file information of a certain file type (such as a common file, a directory file and the like) needs to be counted, other types of files are not counted so as to improve the efficiency.
As shown in fig. 6, an embodiment of the present application provides an information processing apparatus, which may include:
the first request information obtaining module 401 may be configured to obtain first request information for counting the number of directory files, where the first request information carries first directory identification information.
The first directory file obtaining module 403 may be configured to obtain a first directory file corresponding to the first directory identification information.
The traversal result obtaining module 405 may be configured to traverse the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file.
Specifically, the traversal result obtaining module 405 may include:
the file content information acquiring unit may be configured to acquire file content information of the first directory file.
The index information reading unit may be configured to read index information of a subfile included in the first directory file from file content information of the first directory file.
And the traversal result determining unit can be used for taking the index information of the read subfile as the file content information traversal result.
The file number information determining module 407 may be configured to determine, based on the file content information traversal result, file number information included in the first directory file.
Specifically, the file number information determining module 407 may be further configured to: and counting the read index information of the subfiles to obtain the file quantity information contained in the first directory file.
The output module 409 may be configured to output file number information included in the first directory file.
In a possible embodiment, the traversal result obtaining module 405 and the file number information determining module 407 may further include:
the first directory file opening unit may be configured to open the first directory file.
A zeroing unit, which may be configured to count the file number information as 0.
The first current directory file determining unit may be configured to use the first directory file as a first current directory file.
A first file content information acquiring unit, configured to acquire file content information of the first current directory file;
the first current subfile determining unit may be configured to use any one subfile of the first current directory file as the first current subfile.
The first index information reading unit may be configured to read index information of the first current subfile from file content information of the first current directory file, and add 1 to the file number information in an accumulated manner.
The first current directory file re-determining unit may be configured to re-use, as the first current directory file, a directory file composed of files other than the first current subfile in the first current directory file if the subfiles in the first current directory file are not completely traversed or the file number information is smaller than a preset threshold.
The repeating unit may be configured to repeat the step of using any one subfile in the first current directory file as the first current subfile until each subfile in the directory file is traversed or the file number information is greater than or equal to the preset threshold.
In one possible embodiment, the apparatus may further include:
and the alarm unit can be used for sending out alarm prompt information after the file number information is greater than or equal to the preset threshold value.
In one possible embodiment, the apparatus may further include:
the second request information obtaining module may be configured to obtain second request information for counting a directory file type and/or a directory file size, where the second request information carries second directory identification information.
The second directory file obtaining module may be configured to obtain a second directory file corresponding to the second directory identification information.
The second directory file opening module may be configured to open the second directory file.
The second current directory file determination module may be configured to use the second directory file as a second current directory file.
The second file content information obtaining module may be configured to obtain file content information of the second current directory file;
the second current subfile determining module may be configured to use any one subfile of the second current directory file as the second current subfile.
The second index information reading module may be configured to read index information of the second current subfile from file content information of the second current directory file.
The attribute information obtaining module may be configured to read file header information of the second current subfile according to the index information of the second current subfile, so as to obtain attribute information of the second current subfile.
The statistical information determining module may be configured to determine statistical information corresponding to the second request information according to the index information of the second current subfile and the attribute information of the second current subfile.
The second current directory file re-determination module may be configured to re-use, as the second current directory file, a directory file composed of files in the second current directory file, except for the second current subfile, if the second current subfile is not a directory file and does not satisfy the preset traversal level information.
The first repeating module may be configured to repeat the step of using any one subfile in the second current directory file as the second current subfile until all subfiles corresponding to the preset traversal level information are traversed.
The second repeating module may be configured to, if the second current subfile is a directory file and satisfies the preset traversal level information, re-use the second current subfile as a second directory file, and repeat the step of opening the current directory file until each subfile in the preset traversal level information is traversed.
In practical applications, the apparatus may further include:
and the statistical information output module can be used for outputting the statistical information corresponding to the second request information.
It should be noted that the embodiments of the apparatus provided in the embodiments of the present application are based on the same inventive concept as the embodiments of the method described above.
The embodiment of the present application further provides an information processing device, where the electronic device includes a processor and a memory, where the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the information processing method provided in the above method embodiment.
Embodiments of the present application further provide a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the information processing method provided by the above method embodiments.
Alternatively, in the present specification embodiment, the storage medium may be located at least one network server among a plurality of network servers of a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
The memory according to the embodiments of the present disclosure may be used to store software programs and modules, and the processor may execute various functional applications and data processing by operating the software programs and modules stored in the memory. The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs needed by functions and the like; the storage data area may store data created according to use of the apparatus, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory may also include a memory controller to provide the processor access to the memory.
According to the information processing method, the device, the equipment and the storage medium provided by the embodiment of the application, on one hand, a C language voice compiling program is used, a bottom layer function is called to realize related functions, and the performance loss of an upper layer application program is reduced; on the other hand, relevant information is read according to different business requirements, invalid information reading is avoided, and IO (input/output) quantity is reduced. Such as: counting the number information of the files in a certain directory, only reading the file content information of the directory, and not reading the related information (such as file header information of a subfile) of the files in the directory; on the other hand, the method can flexibly control according to different service scenes, the required information can be read and returned, and the whole traversal is not needed, so that the efficiency is improved. Such as: under the application scene that the number of the directory files is more than 100 thousands of alarms need to be sent, when the number of the files is counted to 100 thousands, the program automatically returns; on the other hand, flexible statistics can be carried out according to different service requirements, large and full calculation is avoided, system overhead is reduced, and traversal efficiency is improved. For example, if only the type and quantity information needs to be counted, the size calculation is not performed, and if only the file information of a certain file type (such as a common file, a directory file, and the like) needs to be counted, the other types of files are not counted; on the other hand, the application functions under different scenes are realized by inputting parameters, and the flexibility is improved on the premise of ensuring the efficiency. The information processing method, the device, the equipment and the storage medium provided by the embodiment of the application solve the problem of monitoring the file information in the directory of the large data center through the aspects, so that the requirement of monitoring the directory and the files thereof in the large data center is met.
The embodiment of the information processing method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal, a server or a similar operation device. Taking the example of the server running on the server, fig. 7 is a hardware structure block diagram of the server of the information processing method provided in the embodiment of the present application. As shown in fig. 7, the server 500 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 510 (the processor 510 may include but is not limited to a Processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 530 for storing data, and one or more storage media 520 (e.g., one or more mass storage devices) for storing application programs 523 or data 522. Memory 530 and storage medium 520 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 520 may include one or more modules, each of which may include a series of instruction operations for the server. Still further, the central processor 510 may be configured to communicate with the storage medium 520 to execute a series of instruction operations in the storage medium 520 on the server 500. The server 500 may also include one or more power supplies 560, one or more wired or wireless network interfaces 550, one or more input-output interfaces 540, and/or one or more operating systems 521, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and the like.
The input/output interface 540 may be used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the server 500. In one example, the input/output Interface 540 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the input/output interface 540 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
It will be understood by those skilled in the art that the structure shown in fig. 7 is only an illustration and is not intended to limit the structure of the electronic device. For example, server 500 may also include more or fewer components than shown in FIG. 7, or have a different configuration than shown in FIG. 7.
It should be noted that: the sequence of the embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device and server embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the partial description of the method embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. An information processing method, characterized in that the method comprises:
acquiring first request information for counting the number of directory files, wherein the first request information carries first directory identification information;
acquiring a first directory file corresponding to the first directory identification information;
traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file;
determining file quantity information contained in the first directory file based on the file content information traversal result;
and outputting the file number information contained in the first directory file.
2. The method according to claim 1, wherein traversing the file content information of the first directory file to obtain a traversal result of the file content information corresponding to the first directory file comprises:
acquiring file content information of the first directory file;
reading index information of subfiles contained in the first directory file from file content information of the first directory file;
taking the read index information of the subfile as the traversal result of the file content information;
correspondingly, the determining the file number information contained in the first directory file based on the file content information traversal result includes:
and counting the read index information of the subfiles to obtain the file quantity information contained in the first directory file.
3. The method according to claim 2, wherein the file content information of the first directory file is traversed to obtain a file content information traversal result corresponding to the first directory file; determining the file quantity information contained in the first directory file based on the file content information traversal result, further comprising:
opening the first directory file;
counting the file number information as 0;
taking the first directory file as a first current directory file;
acquiring file content information of the first current directory file;
taking any subfile in the first current directory file as a first current subfile;
reading the index information of the first current subfile from the file content information of the first current directory file, and adding 1 to the file quantity information in an accumulated manner;
if the subfiles in the first current directory file are not completely traversed or the file quantity information is smaller than a preset threshold value, taking the directory file formed by other files except the first current subfile in the first current directory file as the first current directory file again;
and repeating the step of taking any subfile in the first current directory file as the first current subfile until each subfile in the directory file is traversed or the file number information is greater than or equal to the preset threshold value.
4. The method according to claim 3, wherein after the file number information is greater than or equal to the preset threshold, the method further comprises:
and sending out alarm prompt information.
5. The method of claim 2, further comprising,
acquiring second request information for counting the directory file type and/or the directory file size, wherein the second request information carries second directory identification information;
acquiring a second directory file corresponding to the second directory identification information;
opening the second directory file;
taking the second directory file as a second current directory file;
acquiring file content information of the second current directory file;
taking any subfile in the second current directory file as a second current subfile;
reading the index information of the second current subfile from the file content information of the second current directory file;
reading file header information of the second current subfile according to the index information of the second current subfile to obtain attribute information of the second current subfile;
determining statistical information corresponding to the second request information according to the index information of the second current subfile and the attribute information of the second current subfile;
if the second current subfile is not a directory file and does not meet the preset traversal level information, the directory file formed by other files except the second current subfile in the second current directory file is used as the second current directory file again;
repeating the step of taking any subfile in the second current directory file as a second current subfile until all subfiles corresponding to the preset traversal level information are traversed;
and if the second current subfile is a directory file and meets the preset traversal level information, the second current subfile is used as the second directory file again, and the step of opening the current directory file is repeated until each subfile in the preset traversal level information is traversed.
6. The method according to claim 5, wherein after the files corresponding to the preset traversal level information are traversed, the method further comprises:
and outputting the statistical information corresponding to the second request information.
7. An information processing apparatus characterized in that the apparatus comprises:
the system comprises a first request information acquisition module, a first storage module and a second storage module, wherein the first request information acquisition module is used for acquiring first request information for counting the number of directory files, and the first request information carries first directory identification information;
the first directory file acquisition module is used for acquiring a first directory file corresponding to the first directory identification information;
the traversal result acquisition module is used for traversing the file content information of the first directory file to obtain a file content information traversal result corresponding to the first directory file;
the file quantity information determining module is used for determining the file quantity information contained in the first directory file based on the file content information traversal result;
and the output module is used for outputting the file quantity information contained in the first directory file.
8. The apparatus of claim 7, wherein the traversal result obtaining module comprises:
a file content information acquiring unit configured to acquire file content information of the first directory file;
an index information reading unit configured to read index information of a subfile included in the first directory file from file content information of the first directory file;
and the traversal result determining unit is used for taking the read index information of the subfile as the traversal result of the file content information.
9. An electronic device, comprising a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded by the processor and executed to implement the information processing method according to any one of claims 1 to 6.
10. A computer-readable storage medium, in which at least one instruction or at least one program is stored, the at least one instruction or the at least one program being loaded and executed by a processor to implement the information processing method according to any one of claims 1 to 6.
CN201911408766.2A 2019-12-31 2019-12-31 Information processing method, device, equipment and storage medium Pending CN111209159A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911408766.2A CN111209159A (en) 2019-12-31 2019-12-31 Information processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911408766.2A CN111209159A (en) 2019-12-31 2019-12-31 Information processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111209159A true CN111209159A (en) 2020-05-29

Family

ID=70787926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911408766.2A Pending CN111209159A (en) 2019-12-31 2019-12-31 Information processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111209159A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111737204A (en) * 2020-06-12 2020-10-02 北京百度网讯科技有限公司 File directory traversal method, device, equipment and medium
CN114996224A (en) * 2022-07-01 2022-09-02 浙江大华技术股份有限公司 File information statistics method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050256864A1 (en) * 2004-05-14 2005-11-17 Semerdzhiev Krasimir P Fast comparison using multi-level version format
CN102722487A (en) * 2011-03-30 2012-10-10 腾讯科技(深圳)有限公司 Method and apparatus for file management
US20180137117A1 (en) * 2016-11-14 2018-05-17 Tuxera Inc. Systems and methods for storing large files using file allocation table based file systems
CN108255989A (en) * 2017-12-28 2018-07-06 深圳英飞拓科技股份有限公司 Picture storage method, device, terminal device and computer storage media
CN108874930A (en) * 2018-05-31 2018-11-23 郑州云海信息技术有限公司 File attribute information statistical method, device, system, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050256864A1 (en) * 2004-05-14 2005-11-17 Semerdzhiev Krasimir P Fast comparison using multi-level version format
CN102722487A (en) * 2011-03-30 2012-10-10 腾讯科技(深圳)有限公司 Method and apparatus for file management
US20180137117A1 (en) * 2016-11-14 2018-05-17 Tuxera Inc. Systems and methods for storing large files using file allocation table based file systems
CN108255989A (en) * 2017-12-28 2018-07-06 深圳英飞拓科技股份有限公司 Picture storage method, device, terminal device and computer storage media
CN108874930A (en) * 2018-05-31 2018-11-23 郑州云海信息技术有限公司 File attribute information statistical method, device, system, equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111737204A (en) * 2020-06-12 2020-10-02 北京百度网讯科技有限公司 File directory traversal method, device, equipment and medium
CN111737204B (en) * 2020-06-12 2024-03-19 北京百度网讯科技有限公司 File directory traversal method, device, equipment and medium
CN114996224A (en) * 2022-07-01 2022-09-02 浙江大华技术股份有限公司 File information statistics method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN110609743A (en) Method, electronic device and computer program product for configuring resources
CN111881133A (en) Storage bucket management method and device, computer equipment and readable storage medium
US10169085B2 (en) Distributed computing of a task utilizing a copy of an original file stored on a recovery site and based on file modification times
CN107885859B (en) Method and device for file number quota and computer readable storage medium
CN112667405B (en) Information processing method, device, equipment and storage medium
CN111209159A (en) Information processing method, device, equipment and storage medium
Petrov et al. Adaptive performance model for dynamic scaling Apache Spark Streaming
CN111694517A (en) Distributed data migration method and system and electronic equipment
CN112685499A (en) Method, device and equipment for synchronizing process data of work service flow
CN112306369A (en) Data processing method, device, server and storage medium
CN115878394A (en) Memory test method and device, electronic equipment and storage medium
CN105912664B (en) File processing method and equipment
CN111741080B (en) Network file distribution method and device
CN108696559A (en) Method for stream processing and device
KR101810180B1 (en) Method and apparatus for distributed processing of big data based on user equipment
CN111324583A (en) Method and device for classifying service logs
CN115438020A (en) Database resource scheduling method, device, equipment and medium
CN115061813A (en) Cluster resource management method, device, equipment and medium
CN110597572B (en) Service call relation analysis method and computer system
CN113656046A (en) Application deployment method and device
CN113468398A (en) Book level determination method, computing device and computer storage medium
CN112448833A (en) Multi-management-domain communication method and device
CN111258879A (en) Service test scheduling method and device based on page acquisition and intelligent terminal
CN111752956B (en) Entity association change method and device and electronic 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