CN111858495B - File information acquisition method and device, storage medium and electronic equipment - Google Patents

File information acquisition method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111858495B
CN111858495B CN202010718478.3A CN202010718478A CN111858495B CN 111858495 B CN111858495 B CN 111858495B CN 202010718478 A CN202010718478 A CN 202010718478A CN 111858495 B CN111858495 B CN 111858495B
Authority
CN
China
Prior art keywords
attribute
data
file
acquiring
node
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
CN202010718478.3A
Other languages
Chinese (zh)
Other versions
CN111858495A (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.)
Zhuhai Baoqu Technology Co Ltd
Original Assignee
Zhuhai Baoqu Technology 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 Zhuhai Baoqu Technology Co Ltd filed Critical Zhuhai Baoqu Technology Co Ltd
Priority to CN202010718478.3A priority Critical patent/CN111858495B/en
Publication of CN111858495A publication Critical patent/CN111858495A/en
Application granted granted Critical
Publication of CN111858495B publication Critical patent/CN111858495B/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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • 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/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

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 provides a file information acquisition method, a file information acquisition device, a storage medium and electronic equipment, wherein the file information acquisition method comprises the steps of acquiring the number of a target file; acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes; and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute. According to the method and the device for obtaining the file information, the file information is obtained rapidly, the obtaining effect is improved, and the influence on the application functions of other derivative products is effectively avoided.

Description

File information acquisition method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring file information, a storage medium, and an electronic device.
Background
The disk volume format commonly used by the current operating system is NTFS (New Technology File System) file system format, when the volume adopts NTFS format, the volume may store data in clusters, and one data may occupy one or more clusters, where a cluster is a minimum disk unit used in NTFS format, a cluster size is an integer multiple of a sector size, and the cluster size is fixed when formatted, and a sector is a basic unit of disk reading and writing. NTFS uses logical cluster numbers (Logical Cluster Number, LCN) and virtual cluster numbers (Virtual Cluster Number, VCN) to locate clusters. LCNs are simple numbers that go through all clusters in the entire volume. Multiplying the LCN by the volume factor, NTFS can get the physical byte offset on the volume, and thus the physical disk address. The VCN numbers clusters belonging to a particular file from beginning to end in order to reference the data in the file. The VCN may be mapped to an LCN without necessarily requiring physical continuity.
In the related art, when information (such as a data amount or a storage path) of one file needs to be acquired, an application programming interface provided by an operating system is generally called, and the information of the file is acquired from a storage space of the entire operating system by calling a background service of an application providing the application programming interface.
In this way, the obtaining efficiency is low, and the obtaining effect is poor, so that the application functions of other derivative products may be affected.
Disclosure of Invention
The present application aims to solve, at least to some extent, one of the technical problems in the related art.
Therefore, the purpose of the application is to provide a method, a device, a storage medium and an electronic device for acquiring file information, so that the file information can be acquired rapidly, the acquisition effect is improved, and the influence on the application functions of other derivative products is effectively avoided.
In order to achieve the above object, a method for obtaining file information according to an embodiment of a first aspect of the present application includes: acquiring the number of the target file; acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes; and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
In one embodiment of the present application, the obtaining, according to the node attribute, the data amount of the target file includes:
judging whether the file name attribute or the first data attribute in the node attribute contains the data quantity or not;
and if the file name attribute or the first data attribute contains the data volume, directly reading the data volume.
In one embodiment of the present application, further comprising:
if the file name attribute and the first data attribute do not contain the data quantity, acquiring an attribute category of a list attribute in the node attribute;
acquiring a second data attribute corresponding to the attribute category;
the data amount is read from within the second data attribute.
In one embodiment of the present application, the attribute type is a resident attribute or a non-resident attribute, and the acquiring the second data attribute corresponding to the attribute type includes:
if the attribute category is the non-resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises the data volume;
Acquiring the second data attribute from the second file system log;
and if the attribute category is the resident attribute, directly acquiring the second data attribute from an attribute list corresponding to the list attribute.
In one embodiment of the present application, generating a storage path of the target file according to the node attribute includes:
determining the folder name of the father node of the node stored in the target file according to the file name attribute in the node attributes;
backtracking to the target node layer by layer to obtain the folder name of the node corresponding to each layer of storage structure;
and generating the storage path according to the folder names of the layers.
According to the file information acquisition method provided by the embodiment of the first aspect of the application, the number of the target file is acquired, the first file system log corresponding to the number is acquired, the first file system log comprises the node attribute, and the data volume of the target file and/or the storage path of the target file is acquired according to the node attribute, so that the file information is acquired quickly, the acquisition effect is improved, and the influence on the application functions of other derivative products is effectively avoided.
In order to achieve the above object, a file information acquiring apparatus according to an embodiment of the second aspect of the present application includes: the first acquisition module is used for acquiring the number of the target file; the second acquisition module is used for acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes; and the third acquisition module is used for acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
In one embodiment of the present application, the third obtaining module includes:
the judging submodule is used for judging whether the file name attribute or the first data attribute in the node attribute contains the data quantity or not;
and the reading sub-module is used for directly reading the data volume when the file name attribute or the first data attribute contains the data volume.
In one embodiment of the present application, further comprising:
a first determining submodule, configured to obtain an attribute category of a list attribute in the node attribute when neither the file name attribute nor the first data attribute includes the data amount;
and the acquisition sub-module is used for acquiring a second data attribute corresponding to the attribute category and reading the data quantity from the second data attribute.
In one embodiment of the present application, the attribute type is a very resident attribute or a resident attribute, and the obtaining submodule is specifically configured to:
if the attribute category is the non-resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises the data volume;
Acquiring the second data attribute from the second file system log;
and if the attribute category is the resident attribute, directly acquiring the second data attribute from an attribute list corresponding to the list attribute.
In one embodiment of the present application, the third obtaining module includes:
the second determining submodule is used for determining the folder name of the father node of the node stored in the target file according to the file name attribute in the node attribute, backtracking the father node to the target node layer by layer, and obtaining the folder name of the node corresponding to each layer of storage structure;
and the generation sub-module is used for generating the storage path according to the folder names of all the layers.
According to the file information acquisition device provided by the embodiment of the second aspect of the application, the number of the target file is acquired, the first file system log corresponding to the number is acquired, the first file system log comprises the node attribute, and the data volume of the target file and/or the storage path of the generated target file are acquired according to the node attribute, so that the file information is acquired rapidly, the acquisition effect is improved, and the influence on the application functions of other derivative products is effectively avoided.
To achieve the above object, an electronic device according to an embodiment of a third aspect of the present application includes: a processor, a memory, a power circuit, a multimedia component, an audio component, an input/output (I/O) interface, a sensor component, and a communication component; the circuit board is arranged in a space surrounded by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the electronic equipment; the memory is used for storing executable program codes; the processor runs a program corresponding to the executable program code stored in the memory by reading the executable program code for executing: acquiring the number of the target file; acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes; and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
According to the electronic device provided by the embodiment of the third aspect of the application, the number of the target file is acquired, the first file system log corresponding to the number is acquired, the first file system log comprises the node attribute, and the data volume of the target file and/or the storage path of the target file is acquired according to the node attribute, so that the file information is acquired quickly, the acquisition effect is improved, and the influence on the application functions of other derivative products is effectively avoided.
To achieve the above object, a non-transitory computer readable storage medium according to an embodiment of the fourth aspect of the present application, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform a file information acquisition method, the method comprising: acquiring the number of the target file; acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes; and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
According to the non-transitory computer readable storage medium provided by the fourth aspect of the application, by acquiring the number of the target file and acquiring the first file system log corresponding to the number, the first file system log contains the node attribute, and according to the node attribute, the data volume of the target file and/or the storage path of the target file is acquired, so that the file information is quickly acquired, the acquisition effect is improved, and the influence on the application functions of other derivative products is effectively avoided.
To achieve the above object, a computer program product according to an embodiment of a fifth aspect of the present application, when instructions in the computer program product are executed by a processor, performs a file information acquiring method, the method comprising: acquiring the number of the target file; acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes; and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
According to the computer program product provided by the embodiment of the fifth aspect of the application, the number of the target file is obtained, the first file system log corresponding to the number is obtained, the first file system log comprises the node attribute, and the data volume of the target file and/or the storage path of the target file is obtained according to the node attribute, so that the file information is obtained quickly, the obtaining effect is improved, and the influence on the application functions of other derivative products is effectively avoided.
Additional aspects and advantages of the application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a flowchart of a method for acquiring file information according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of an NTFS storage structure in an embodiment of the present application;
FIG. 3 is a flowchart of a method for obtaining file information according to another embodiment of the present disclosure;
FIG. 4 is a flowchart of a method for obtaining file information according to another embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a document information acquiring apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a file information acquiring apparatus according to another embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application. On the contrary, the embodiments of the present application include all alternatives, modifications, and equivalents as may be included within the spirit and scope of the appended claims.
Fig. 1 is a flowchart of a file information obtaining method according to an embodiment of the present application.
In order to solve the technical problems that in the related art, file information acquisition efficiency is low and an acquisition effect is poor, so that application functions of other derivative products can be affected, the application of the other derivative products is effectively avoided by acquiring the number of the target file and acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes, acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attributes, and achieving the purposes of quickly acquiring the file information, improving the acquisition effect and effectively avoiding affecting the application functions of the other derivative products.
The present embodiment is exemplified by the file information acquiring method being configured in the file information acquiring apparatus.
The file information acquiring method of the present embodiment may be configured in a file information acquiring apparatus, which may be provided in a server or may be provided in a computer device, which is not limited in the embodiment of the present application.
The present embodiment takes an example in which the file information acquiring method is configured in a computer device.
The execution body of the embodiment of the present application may be, for example, a central processing unit (Central Processing Unit, CPU) in a server or a computer device in hardware, and may be, for example, a relevant background service in a server or a computer device in software, which is not limited.
Referring to fig. 1, the file information acquisition method includes:
s101: and obtaining the number of the target file.
The file of the current information to be checked may be referred to as a target file.
The target file is usually pre-stored in a disk of the operating system in NTFS (New Technology File System) file system format, so that the target file will have a corresponding NTFS storage structure, referring to fig. 2, fig. 2 is a schematic diagram of the NTFS storage structure in this embodiment of the present application, fig. 2 depicts that there is a file a.file under a root token of the operating system, and a folder bdir, where there are two files c.txt and d.exe under the folder bdir, and each file has a corresponding number, where the numbers include a number describing a file itself in the NTFS storage structure and a number of a parent node folder, and the above-mentioned parthenofilereference number can be understood as: directoryfilereference number (number of parent node folder in the lineage).
Thus, the numbers of the target files obtained in the present application, that is, the filereference number and the partntfilereference number, can be used to describe the storage architecture of the files in the NTFS storage structure.
For example, the filereference number and the parthenofilereference number of the target file may be obtained by automatically analyzing the file information query requirement by the computer device, or may be obtained by inputting the query user to the computer device via a man-machine interaction interface, and may be obtained by receiving the query user by the computer device, or may be obtained by reading the query user from a third-party hardware device by the computer device, which is not limited.
And triggering and executing the subsequent steps of acquiring the data volume of the target file based on the number and/or generating a storage path of the target file after the number of the target file is acquired.
S102: and acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes.
The software mechanism responsible for managing and storing file information in the operating system is called a file management system, and is called a file system for short. From a system perspective, a file system is a system that organizes and allocates space for file storage devices, is responsible for storing files, and protects and retrieves stored files. Specifically, it is responsible for creating files for users, storing, reading out, modifying, dumping files, controlling access to files, revoking files when users are no longer using, etc.
The file system log is just a log for assisting the operation of the file system, recording the file system to establish files, storing, reading, modifying and dumping the files and controlling the access of the files.
The FILE system log in the embodiment of the present application is specifically an NTFS FILE system log (ntfs_file_record).
In a specific implementation process, when the computer device automatically analyzes the file information query requirement, and thus identifies the number of the obtained target file, a corresponding file system log may be obtained according to the number, and the file system log obtained this time may be referred to as a first file system log.
For example, according to the number filereference number of a given target FILE, ntfs_file_record (first FILE system log) may be read by calling API DeviceIoControl, where the first FILE system log includes node attributes, where the node attributes are a stream structure and may include various attributes.
Optionally, the number of node attributes is a plurality, and the plurality of node attributes includes: the file name attribute, the first data attribute, and the list attribute, each node attribute is used to characterize a feature of the file to which the node attribute belongs, that is, a storage feature of the file to which the node attribute belongs in the first file system log.
For example, an AttributeAttributeList (list attribute) will have a node attribute when a file requires multiple MFT (i.e. master file table (Master File Table)) file records, and when a file has the list attribute, a corresponding attribute list will correspond to the attribute list, where the attribute list includes the node attributes that form the file, and file references of MFT file records where each node attribute is located.
The AttributeFileName attribute may be multiple, long filenames are automatically converted to corresponding short filenames (which can facilitate MS-DOS and 16-bit program access), or the node attribute may be carried when the file has a hard link.
The first data attribute described above, i.e., the general data attribute (AttributeData), is identified herein for the purpose of distinguishing the first data attribute from another data attribute described below, and is not to be taken as a particular limitation.
Data attributes (AttributeData), a file has only one unnamed data attribute, but may have an additional plurality of named data attributes, i.e. a file may have multiple data streams, a directory has no default data attributes, but may have multiple alternative named data attributes.
S103: and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
Since the first file system log corresponding to the number is obtained, the first file system log contains the node attribute, which can be understood as obtaining the first file system log of the portion corresponding to the number of the target file from the NTFS file system log of the whole operating system, thereby reducing the search space and improving the obtaining efficiency.
When the data amount of the target file is obtained according to the node attribute and/or the storage path of the target file is generated, the corresponding data amount can be read by traversing each node attribute, or the folder name of the parent node at the upper level of the storage structure of the target file is determined according to the file name attribute, and the storage path is obtained by backtracking layer by layer, or any other possible method can be adopted to obtain the data amount and/or the storage path of the target file according to the node attribute, so that the method is not limited.
In this embodiment, by acquiring the number of the target file and acquiring the first file system log corresponding to the number, where the first file system log includes the node attribute, and according to the node attribute, acquiring the data size of the target file and/or generating the storage path of the target file, the file information is quickly acquired, so as to improve the acquisition effect, and effectively avoid affecting the application functions of other derivative products.
Fig. 3 is a flowchart of a file information obtaining method according to another embodiment of the present application.
The embodiment is applied to a scene of acquiring the data volume of the target file.
Referring to fig. 3, the file information acquisition method includes:
s301: and judging whether the file name attribute or the first data attribute in the node attribute contains the data quantity or not.
S302: if the file name attribute or the first data attribute contains the data amount, the data amount is directly read.
In this embodiment, whether the file name attribute or the first data attribute includes the data amount may be judged first, so that a step of traversing node attributes in the log of the whole file system is avoided, thereby enabling acquisition of target file information to be more targeted, and improving acquisition hit rate.
S303: and if the file name attribute and the first data attribute do not contain the data quantity, acquiring the attribute category of the list attribute in the node attribute.
That is, an attribute class of the get list attribute (AttributeAttributeList), which may be a very resident attribute or a resident attribute.
S304: and acquiring a second data attribute corresponding to the attribute category.
In some embodiments, if the attribute category is a resident attribute, determining a storage address indicated by the list attribute; acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises data quantity; acquiring a second data attribute from a second file system log; if the attribute category is the resident attribute, the second data attribute is directly obtained from the attribute list corresponding to the list attribute.
S305: the amount of data is read from within the second data attribute.
Generally, according to the characteristic of the non-resident attribute, when the attribute type of the list attribute is the non-resident attribute, the list attribute may be regarded as a pointer, a storage address indicated by the list attribute is determined, so as to obtain a file system log corresponding to a disk indicated by the storage address, the file system log may be called a second file system log, then a corresponding data attribute (AttributeData) is obtained from the second file system log, the re-obtained data attribute (AttributeData) may be called a second data attribute, and the second data attribute is identified herein, so as to distinguish from another data attribute above, and is not regarded as a specific limitation, thereby assisting in directly reading the data amount from the second data attribute, and when the attribute type is the non-resident attribute, the second data attribute is directly obtained from the attribute list corresponding to the list attribute.
For example, the program code definition for the very resident properties may be as follows:
for example, the program code definition of the resident properties may be as follows:
for example, for an attribute list example corresponding to a list attribute of a resident attribute:
ATTRIBUTE Attribute; attribute//
Ulongglong LowVcn; lower virtual cluster number
ULONGLONG HighVcn; high-order virtual cluster number
USHORT RunArrayOffset; load array offset
UCHAR CompressionUnit; compression unit
UCHAR AlignmentOrReserved [5]; alignment or reservation of//
ULONGLONG AllocatedSize; size of// allocation
ULONGLONG DataSize; data volume//
ULONGLONG InitializedSize; volume of data per initial volume of data
ULONGLONG CompressedSize; and/amount of compressed data.
So that the second data attribute can be directly obtained therefrom and the corresponding data amount DataSize thereof can be read.
The program code of the present embodiment can be exemplified as follows:
the description of the program code is as follows:
loading a first file system log NtfsFileRecord corresponding to the number FileReferenceNumber of the target file, searching a FileName file name attribute from an attribute list of the first file system log NtfsFileRecord, returning a result if the first file system log NtfsFileRecord contains the data quantity of the target file, searching a DataAttribute from the attribute list if the first file system log NtfsFileRecord does not contain the data quantity of the target file, returning the result if the first file system does not contain the data quantity of the target file, searching an Attribute list attribute from the attribute list if the first file system log NtfsFileRecord does not contain the data quantity of the target file, judging the attribute type of the list attribute, reloading a second file system log NtfsFileRecord in a corresponding disk structure if the first file system log NtfsFileRecord does not contain the data quantity of the target file, and directly searching a DataAttribute from the attribute list if the first file system log NtfsFileRecord does not contain the data quantity of the target file, and acquiring the data quantity of the target file according to the second data attribute.
In this embodiment, by determining whether the file name attribute or the first data attribute includes a data amount, when the file name attribute or the first data attribute includes a data amount, the data amount is directly read, and when the file name attribute and the first data attribute do not include a data amount, the attribute category of the list attribute is acquired, the second data attribute corresponding to the attribute category is acquired, and the data amount is read from the second data attribute, so that the acquisition of the target file information is more targeted, the acquisition hit rate is improved, and the acquisition effect is improved.
Fig. 4 is a flowchart of a file information obtaining method according to another embodiment of the present application.
The embodiment is applied to a scene of acquiring a storage path of a target file.
Referring to fig. 4, the file information acquisition method includes:
s401: and obtaining the number of the target file.
The file of the current information to be checked may be referred to as a target file.
The target file is usually pre-stored in a disk of the operating system in NTFS (New Technology File System) file system format, so that the target file will have a corresponding NTFS storage structure, referring to fig. 2, fig. 2 is a schematic diagram of the NTFS storage structure in this embodiment of the present application, fig. 2 depicts that there is a file a.file under a root token of the operating system, and a folder bdir, where there are two files c.txt and d.exe under the folder bdir, and each file has a corresponding number, where the numbers include a number describing a file itself in the NTFS storage structure and a number of a parent node folder, and the above-mentioned parthenofilereference number can be understood as: directoryfilereference number (number of parent node folder in the lineage).
Thus, the numbers of the target files obtained in the present application, that is, the filereference number and the partntfilereference number, can be used to describe the storage architecture of the files in the NTFS storage structure.
For example, the filereference number and the parthenofilereference number of the target file may be obtained by automatically analyzing the file information query requirement by the computer device, or may be obtained by inputting the query user to the computer device via a man-machine interaction interface, and may be obtained by receiving the query user by the computer device, or may be obtained by reading the query user from a third-party hardware device by the computer device, which is not limited.
And triggering and executing the subsequent steps of acquiring the data volume of the target file based on the number and/or generating a storage path of the target file after the number of the target file is acquired.
S402: and acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes.
In a specific implementation process, when the computer device automatically analyzes the file information query requirement, and thus identifies the number of the obtained target file, a corresponding file system log may be obtained according to the number, and the file system log obtained this time may be referred to as a first file system log.
For example, according to the number filereference number of a given target FILE, fsctl_get_ntfs_file_record may be read by calling API DeviceIoControl and used as a first FILE system log, where the first FILE system log includes FILE name attributes.
Program code example:
FILE_RECORD=DeviceIoControl(FileReferenceNumberFSCTL_GET_NTFS_FILE_RECORD)。
s403: and determining the folder names of the father nodes of the nodes stored in the target file according to the file name attribute in the node attribute, and backtracking the father nodes to the target node layer by layer to obtain the folder names of the nodes corresponding to the storage structures of each layer.
S404: and generating a storage path according to the names of the folders of each layer.
The program code is exemplified as follows:
/>
the description of the program code is as follows:
1. given the corresponding number FileReferenceNumber of the target FILE, the corresponding first FILE system log FSCTL_GET_NTFS_FILE_RECORD is obtained through APIDeviceControl.
FILE_RECORD=DeviceIoControl(FileReferenceNumber,FSCTL_GET_NTFS_FILE_RECORD)。
2. Traversing the AttributeType corresponding to the current FILE_RECORD to find the attribute of the AttributeFileName FILE name, and backtracking the recursive parent FILE folder layer by layer, thereby obtaining a complete FILE path.
The layer-by-layer backtracking recursive parent folder can be realized by adopting a recursive backtracking function, and is not limited.
In this embodiment, by acquiring the number of the target file, acquiring a first file system log corresponding to the number, where the first file system log includes node attributes, determining the folder name of the parent node of the node stored in the target file according to the file name attributes, backtracking to the target node layer by layer, obtaining the folder name of the node corresponding to each layer of storage structure, and generating a storage path according to each layer of folder name, thereby implementing fast generation of the storage path of the file, expanding the application scenario of file information acquisition, and effectively assisting the application function of other derivative products.
Fig. 5 is a schematic structural diagram of a file information acquiring apparatus according to an embodiment of the present application.
Referring to fig. 5, the apparatus 500 includes:
a first obtaining module 501, configured to obtain a number of a target file;
a second obtaining module 502, configured to obtain a first file system log corresponding to the number, where the first file system log includes a node attribute;
the third obtaining module 503 is configured to obtain the data amount of the target file and/or generate a storage path of the target file according to the node attribute.
Optionally, in some embodiments, referring to fig. 6, the third obtaining module 503 includes:
A judging submodule 5031 for judging whether the file name attribute or the first data attribute in the node attribute contains the data amount;
the reading submodule 5032 is configured to directly read the data volume when the file name attribute or the first data attribute contains the data volume.
Optionally, in some embodiments, referring to fig. 6, the third obtaining module 503 further includes:
a first determining submodule 5033, configured to obtain an attribute category of a list attribute in the node attribute when neither the file name attribute nor the first data attribute contains the data amount;
an acquisition submodule 5034 is configured to acquire a second data attribute corresponding to the attribute category, and to read an amount of data from within the second data attribute.
Optionally, in some embodiments, the attribute category is a resident attribute or a resident attribute, and the obtaining submodule 5034 is specifically configured to:
if the attribute type is the very resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises data quantity;
acquiring a second data attribute from a second file system log;
if the attribute category is the resident attribute, the second data attribute is directly obtained from the attribute list corresponding to the list attribute.
Optionally, in some embodiments, the third obtaining module 503 includes:
a second determining submodule 5035, configured to determine, according to the file name attribute in the node attribute, a folder name of a parent node of the node stored in the target file, and trace back to the target node layer by layer, so as to obtain a folder name of a node corresponding to each layer of storage structure;
a generation submodule 5036 for generating a storage path according to the folder names of the layers.
It should be noted that the explanation of the embodiment of the file information acquiring method in the foregoing embodiments of fig. 1 to fig. 4 is also applicable to the file information acquiring apparatus 500 of this embodiment, and the implementation principle is similar, and will not be repeated here.
In this embodiment, by acquiring the number of the target file and acquiring the first file system log corresponding to the number, where the first file system log includes the node attribute, and according to the node attribute, acquiring the data size of the target file and/or generating the storage path of the target file, the file information is quickly acquired, so as to improve the acquisition effect, and effectively avoid affecting the application functions of other derivative products.
Embodiments of the present application also provide an electronic device, referring to fig. 7, an electronic device 700 may include one or more of the following components: a processor 701, a memory 702, a power circuit 703, a multimedia component 704, an audio component 705, an input/output (I/O) interface 706, a sensor component 707, and a communication component 708.
A power supply circuit 703 for supplying power to the respective circuits or devices of the electronic apparatus; memory 702 is used to store executable program code; the processor 701 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 702, for performing the steps of:
acquiring the number of the target file;
acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
It should be noted that the explanation of the embodiment of the file information obtaining method in the foregoing embodiments of fig. 1 to fig. 4 is also applicable to the electronic device 700 of this embodiment, and the implementation principle is similar, and will not be repeated here.
In this embodiment, by acquiring the number of the target file and acquiring the first file system log corresponding to the number, where the first file system log includes the node attribute, and according to the node attribute, acquiring the data size of the target file and/or generating the storage path of the target file, the file information is quickly acquired, so as to improve the acquisition effect, and effectively avoid affecting the application functions of other derivative products.
To achieve the above embodiments, the present application also proposes a non-transitory computer-readable storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform a file information acquisition method, the method comprising:
acquiring the number of the target file;
acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
The non-transitory computer readable storage medium in this embodiment obtains the number of the target file, and obtains the first file system log corresponding to the number, where the first file system log includes the node attribute, and obtains the data volume of the target file and/or generates the storage path of the target file according to the node attribute, so as to quickly obtain the file information, improve the obtaining effect, and effectively avoid affecting the application functions of other derivative products.
To achieve the above embodiments, the present application further proposes a computer program product, which when executed by a processor, performs a file information acquiring method, the method comprising:
Acquiring the number of the target file;
acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
and acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute.
The computer program product in this embodiment obtains the number of the target file, and obtains the first file system log corresponding to the number, where the first file system log includes the node attribute, and obtains the data size of the target file and/or generates the storage path of the target file according to the node attribute, so as to quickly obtain the file information, improve the obtaining effect, and effectively avoid affecting the application functions of other derivative products.
It should be noted that in the description of the present application, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Furthermore, in the description of the present application, unless otherwise indicated, the meaning of "a plurality" is two or more.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives, and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (11)

1. A method for obtaining file information, the method comprising:
acquiring the number of the target file;
acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
Acquiring the data volume of a target file and/or generating a storage path of the target file according to the node attribute;
the method further comprises the steps of:
if the file name attribute and the first data attribute in the node attribute do not contain the data quantity, acquiring an attribute category of a list attribute in the node attribute, wherein the attribute category is a very resident attribute or a resident attribute;
if the attribute category is the non-resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises the data volume;
acquiring the second data attribute from the second file system log, and reading the data amount from the second data attribute;
and if the attribute category is the resident attribute, directly acquiring the second data attribute from an attribute list corresponding to the list attribute, and reading the data volume from the second data attribute.
2. The file information acquiring method according to claim 1, wherein the acquiring the data amount of the target file based on the node attribute includes:
Judging whether the file name attribute or the first data attribute in the node attribute contains the data quantity or not;
and if the file name attribute or the first data attribute contains the data volume, directly reading the data volume.
3. The file information acquiring method according to claim 2, characterized by further comprising:
if the file name attribute and the first data attribute do not contain the data quantity, acquiring an attribute category of a list attribute in the node attribute;
acquiring a second data attribute corresponding to the attribute category;
the data amount is read from within the second data attribute.
4. The file information acquisition method according to claim 1, wherein generating a storage path of the target file based on the node attribute comprises:
determining the folder name of the father node of the node stored in the target file according to the file name attribute in the node attributes;
backtracking to the target node layer by layer to obtain the folder name of the node corresponding to each layer of storage structure;
and generating the storage path according to the folder names of the layers.
5. A file information acquisition apparatus, characterized in that the apparatus comprises:
The first acquisition module is used for acquiring the number of the target file;
the second acquisition module is used for acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
the third acquisition module is used for acquiring the data volume of the target file and/or generating a storage path of the target file according to the node attribute;
the device is used for:
if the file name attribute and the first data attribute in the node attribute do not contain the data quantity, acquiring an attribute category of a list attribute in the node attribute, wherein the attribute category is a very resident attribute or a resident attribute;
if the attribute category is the non-resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises the data volume;
acquiring the second data attribute from the second file system log, and reading the data amount from the second data attribute;
and if the attribute category is the resident attribute, directly acquiring the second data attribute from an attribute list corresponding to the list attribute, and reading the data volume from the second data attribute.
6. The file information acquiring apparatus according to claim 5, wherein the third acquiring module includes:
the judging submodule is used for judging whether the file name attribute or the first data attribute in the node attribute contains the data quantity or not;
and the reading sub-module is used for directly reading the data volume when the file name attribute or the first data attribute contains the data volume.
7. The file information acquiring apparatus as claimed in claim 6, further comprising:
a first determining submodule, configured to obtain an attribute category of a list attribute in the node attribute when neither the file name attribute nor the first data attribute includes the data amount;
and the acquisition sub-module is used for acquiring a second data attribute corresponding to the attribute category and reading the data quantity from the second data attribute.
8. The file information acquiring apparatus according to claim 5, wherein the third acquiring module includes:
the second determining submodule is used for determining the folder name of the father node of the node stored in the target file according to the file name attribute in the node attribute, backtracking the father node to the target node layer by layer, and obtaining the folder name of the node corresponding to each layer of storage structure;
And the generation sub-module is used for generating the storage path according to the folder names of all the layers.
9. An electronic device comprising one or more of the following: a processor, a memory, a power circuit, a multimedia component, an audio component, an input/output (I/O) interface, a sensor component, and a communication component; the circuit board is arranged in a space surrounded by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the electronic equipment; the memory is used for storing executable program codes; the processor runs a program corresponding to the executable program code stored in the memory by reading the executable program code for executing:
acquiring the number of the target file;
acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
acquiring the data volume of a target file and/or generating a storage path of the target file according to the node attribute;
acquiring the data volume of a target file and/or generating a storage path of the target file according to the node attribute;
The step of obtaining the data volume of the target file according to the node attribute further comprises the following steps:
if the file name attribute and the first data attribute in the node attribute do not contain the data quantity, acquiring an attribute category of a list attribute in the node attribute, wherein the attribute category is a very resident attribute or a resident attribute;
if the attribute category is the non-resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises the data volume;
acquiring the second data attribute from the second file system log, and reading the data amount from the second data attribute;
and if the attribute category is the resident attribute, directly acquiring the second data attribute from an attribute list corresponding to the list attribute, and reading the data volume from the second data attribute.
10. A non-transitory computer-readable storage medium having stored thereon a computer program, wherein the program when executed by a processor implements the file information acquisition method according to any one of claims 1 to 4.
11. A computer program product, which when executed by a processor, performs a method of file information acquisition, the method comprising:
acquiring the number of the target file;
acquiring a first file system log corresponding to the number, wherein the first file system log comprises node attributes;
acquiring the data volume of a target file and/or generating a storage path of the target file according to the node attribute;
the method further comprises the steps of:
if the file name attribute and the first data attribute in the node attribute do not contain the data quantity, acquiring an attribute category of a list attribute in the node attribute, wherein the attribute category is a very resident attribute or a resident attribute;
if the attribute category is the non-resident attribute, determining a storage address indicated by the list attribute;
acquiring a second file system log corresponding to the disk indicated by the storage address, wherein a second data attribute of the second file system log comprises the data volume;
acquiring the second data attribute from the second file system log, and reading the data amount from the second data attribute;
And if the attribute category is the resident attribute, directly acquiring the second data attribute from an attribute list corresponding to the list attribute, and reading the data volume from the second data attribute.
CN202010718478.3A 2020-07-23 2020-07-23 File information acquisition method and device, storage medium and electronic equipment Active CN111858495B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010718478.3A CN111858495B (en) 2020-07-23 2020-07-23 File information acquisition method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010718478.3A CN111858495B (en) 2020-07-23 2020-07-23 File information acquisition method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111858495A CN111858495A (en) 2020-10-30
CN111858495B true CN111858495B (en) 2024-04-05

Family

ID=72950478

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010718478.3A Active CN111858495B (en) 2020-07-23 2020-07-23 File information acquisition method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111858495B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398760A (en) * 2007-09-27 2009-04-01 广达电脑股份有限公司 Firmware updating system and updating method thereof
CN101510219A (en) * 2009-03-31 2009-08-19 成都市华为赛门铁克科技有限公司 File data accessing method, apparatus and system
CN101630322A (en) * 2009-08-26 2010-01-20 中国人民解放军信息工程大学 Method for storing and accessing file set under tree directory structure in database
CN104462112A (en) * 2013-09-17 2015-03-25 上海华虹集成电路有限责任公司 File system storage module
CN105579950A (en) * 2013-07-02 2016-05-11 日立数据系统工程英国有限公司 Method and apparatus for migration of a virtualized file system, data storage system for migration of a virtualized file system, and file server for use in a data storage system
CN106653066A (en) * 2016-10-21 2017-05-10 广东欧珀移动通信有限公司 Music pushing method and device based on sound box
CN108021590A (en) * 2016-10-28 2018-05-11 阿里巴巴集团控股有限公司 A kind of destination object attribute determining method, attribute update method and device
CN105279278B (en) * 2015-11-13 2019-03-12 珠海豹趣科技有限公司 The searching method and device of file

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3997428B2 (en) * 2003-09-25 2007-10-24 ソニー株式会社 Recording apparatus, file management method, file management method program, and recording medium recording file management method program
US8285692B2 (en) * 2010-01-15 2012-10-09 Oracle America, Inc. Method and system for attribute encapsulated data resolution and transcoding

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398760A (en) * 2007-09-27 2009-04-01 广达电脑股份有限公司 Firmware updating system and updating method thereof
CN101510219A (en) * 2009-03-31 2009-08-19 成都市华为赛门铁克科技有限公司 File data accessing method, apparatus and system
CN101630322A (en) * 2009-08-26 2010-01-20 中国人民解放军信息工程大学 Method for storing and accessing file set under tree directory structure in database
CN105579950A (en) * 2013-07-02 2016-05-11 日立数据系统工程英国有限公司 Method and apparatus for migration of a virtualized file system, data storage system for migration of a virtualized file system, and file server for use in a data storage system
CN104462112A (en) * 2013-09-17 2015-03-25 上海华虹集成电路有限责任公司 File system storage module
CN105279278B (en) * 2015-11-13 2019-03-12 珠海豹趣科技有限公司 The searching method and device of file
CN106653066A (en) * 2016-10-21 2017-05-10 广东欧珀移动通信有限公司 Music pushing method and device based on sound box
CN108021590A (en) * 2016-10-28 2018-05-11 阿里巴巴集团控股有限公司 A kind of destination object attribute determining method, attribute update method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
NTFS文件系统文件存储层次结构解析;田素诚;《福建电脑》;第35卷(第07期);17-20 *

Also Published As

Publication number Publication date
CN111858495A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
US10908925B2 (en) Dynamic loading method, and target file creation method and apparatus
KR100600671B1 (en) Method, system, and program for managing devices in a network
JP4979934B2 (en) Extended file system
US9367569B1 (en) Recovery of directory information
CN110232969A (en) Medical image is uploaded to the method, apparatus, terminal and storage medium of Cloud Server
CN102890651B (en) The method of testing of a kind of contextual data and device
US9542111B2 (en) Writable clone data structure
CN111241040A (en) Information acquisition method and device, electronic equipment and computer storage medium
CN114461691A (en) Control method and device of state machine, electronic equipment and storage medium
WO2022228500A1 (en) Data storage method and apparatus for bios, device and storage medium
CN116483859A (en) Data query method and device
CN111858495B (en) File information acquisition method and device, storage medium and electronic equipment
CN116150539A (en) Page rendering method and device and electronic equipment
CN114077575B (en) Format conversion method, equipment and system for memory snapshot file
CN116303278A (en) File merging method, file reading method, device, equipment and storage medium
CN113507529B (en) Method for realizing file downloading based on Web application
CN111858494B (en) File acquisition method and device, storage medium and electronic equipment
CN112035119B (en) Data deleting method and device
CN111881220B (en) Data operation method and device under list storage, electronic equipment and storage medium
CN113111138A (en) Data processing method, device, computing equipment and medium
CN112860628A (en) File system scale management method and system
JP2016146022A (en) Model base development support device, model base development support method, and model base development support program
CN113890872B (en) Data set uploading method and device, electronic equipment and storage medium
CN115373595B (en) Storage system access method and device, electronic equipment and storage medium
CN112445790B (en) Report data storage method, device, equipment and medium

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