File processing method and computer equipment

By setting the extended properties of the file, recording the file path information, and establishing the association relationship between files, the problem of low file correlation in the existing technology is solved, and the accuracy and efficiency of file management are achieved.

CN119474027APending Publication Date: 2025-02-18HENAN KUNLUN TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411581317.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, the correlation between files is low, resulting in confusion in file management and prone to file loss.

Method used

By acquiring the file information of the first file and the file path information of the second file, setting the extended attributes of the first file, recording the file information of the second file, thereby establishing the association relationship between the first file and the second file.

Benefits of technology

The accurate association between the first file and the second file is realized, so as to facilitate the finding and processing of the second file through the first file, and avoid file management chaos and loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474027A_ABST
    Figure CN119474027A_ABST
Patent Text Reader

Abstract

The invention provides a file processing method and computer equipment, and the method comprises the steps: obtaining file information of a first file in response to a first operation of a user; based on the file information of the first file, extended attribute information of the first file is obtained, and the extended attribute information comprises file path information of a second file; wherein the relationship between the first file and the second file comprises at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, and the first file is a file generated after the second file runs abnormally; or the second file is an executable file of the first file; and processing the second file based on the file path information of the second file. Through the file processing method provided by the invention, the second file corresponding to the first file can be accurately determined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a file processing method and a computer device. Background Art

[0002] In an operating system, it is often necessary to associate different files. Currently, the association between files can be obtained based on the logical requirements of a specific application. For example, the association between a backup file and an original file, or the association between a signature file and an original file, etc. However, due to the lack of a unified naming convention for files in the file system of the operating system, the existing technology of establishing the association between files through file names is often not rigorous enough, and files are easily lost, resulting in chaotic file management. Summary of the invention

[0003] The present application provides a file processing method and a computer device to solve the technical problem that the correlation between files is low and file confusion is easily caused.

[0004] In the first aspect, the present application provides a file processing method, the method comprising: in response to a first operation of a user, obtaining file information of a first file; based on the file information of the first file, obtaining extended attribute information of the first file, the extended attribute information including file path information of a second file; wherein the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file; the second file is processed based on the file path information of the second file. Through the above technical solution, the first file and the second file can be associated, so that it is convenient to accurately find the second file through the first file and process the second file, avoiding file confusion.

[0005] In a possible implementation, the first file is a backup file of the second file, and the processing of the second file based on the file path information of the second file includes: copying the first file, and saving the copied first file according to the file path information of the second file to restore the second file. The above technical solution can associate the original file with the backup file, and improve the accuracy of restoring the original file.

[0006] In a possible implementation, the first file is the file after the second file is moved to a trash folder, and the processing of the second file based on the file path information of the second file includes: moving the first file to a file path corresponding to the file path information of the second file to restore the second file. The above technical solution can associate the original file with the original file after it is moved to the trash folder, which can improve the efficiency and accuracy of obtaining the original file.

[0007] In a possible implementation, the method further includes: deleting the extended attribute information of the first file. Through the above technical solution, after the original file is restored, the state of the original file can be reflected in real time by deleting the extended attribute information of the first file.

[0008] In a possible implementation, the first file is a signature file of the second file, and the processing of the second file based on the file path information of the second file includes: obtaining the second file based on the file path information of the second file; and sending the first file and the second file. Through the above technical solution, the file path information of the signature file and the original file can be accurately recorded, which is convenient for archiving and managing the signature file.

[0009] In a possible implementation, the first file is a file generated after the second file runs abnormally, and the processing of the second file based on the file path information of the second file includes: displaying the second file based on the file path information of the second file. Through the above technical solution, the file path of the second file can be accurately recorded according to the file path information of the second file, avoiding the problem of being unable to determine the corresponding second file when multiple first files exist at the same time.

[0010] In a possible implementation, the second file is an executable file of the first file, and the processing of the second file based on the file path information of the second file includes: executing the second file based on the file path information of the second file, so that the second file runs the first file. Through the above technical solution, the executable file of the first file can be accurately and concisely determined, and the first file can be run quickly and efficiently through the second file.

[0011] In a possible implementation, the method further includes: in response to a second operation of the user, obtaining file path information of the second file; and storing the file path information of the second file in a storage area corresponding to the file extension attribute block of the first file. Through the above technical solution, the association relationship between the first file and the second file can be accurately recorded through the storage area corresponding to the file extension attribute block of the first file.

[0012] In a possible implementation, the obtaining of the extended attribute information of the first file based on the file information of the first file includes: determining the index node corresponding to the first file according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block; and obtaining the extended attribute information of the first file from the data block according to the pointer. Through the above technical solution, the association relationship between the first file and the second file can be bound through the extended attribute information of the first file, so as to facilitate accurate acquisition of the second file based on the first file.

[0013] In a possible implementation, the first operation includes inputting a first instruction, where the first instruction includes file information of the first file, or the first operation is a click operation on the first file.

[0014] In the second aspect, the present application provides a file processing method, the method comprising: in response to a second operation of a user, obtaining file information of a first file and file path information of a second file, wherein the file information of the first file corresponds to a storage area of ​​a file extension attribute of the first file; storing the file path information of the second file in a storage area of ​​a file extension attribute of the first file; wherein the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file. Through the above technical solution, the extended attributes of the first file can be set, the file information of the corresponding second file can be recorded, and an association relationship between the first file and the second file can be established, so as to facilitate accurate processing of the second file according to the extended attributes of the first file.

[0015] In a third aspect, the present application provides a file processing device, including: an acquisition module, for acquiring file information of a first file in response to a first operation of a user; the acquisition module is also used to acquire extended attribute information of the first file based on the file information of the first file, and the extended attribute information includes file path information of a second file; wherein the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file; a processing module is used to process the second file based on the file path information of the second file. Through the above technical solution, the first file and the second file can be associated, so that it is convenient to accurately find the second file through the first file and process the second file, avoiding file confusion.

[0016] In a possible implementation, the first file is a backup file of the second file, and the processing module is further used to copy the first file, and save the copied first file according to the file path information of the second file to restore the second file. The above technical solution can associate the original file with the backup file, which can improve the accuracy of restoring the original file.

[0017] In a possible implementation, the first file is the file after the second file is moved to a trash folder, and the processing module is further used to move the first file to a file path corresponding to the file path information of the second file to restore the second file. The above technical solution can associate the original file with the original file after it is moved to the trash folder, which can improve the efficiency and accuracy of obtaining the original file.

[0018] In a possible implementation, the processing module is further used to delete the extended attribute information of the first file. Through the above technical solution, after the original file is restored, the state of the original file can be reflected in real time by deleting the extended attribute information of the first file.

[0019] In a possible implementation, the first file is a signature file of the second file, and the processing module is further used to obtain the second file based on the file path information of the second file; and send the first file and the second file. Through the above technical solution, the file path information of the signature file and the original file can be accurately recorded, which is convenient for archiving and managing the signature file.

[0020] In a possible implementation, the first file is a file generated after the second file runs abnormally, and the processing module is further used to display the second file based on the file path information of the second file. Through the above technical solution, the file path of the second file can be accurately recorded according to the file path information of the second file, avoiding the problem of being unable to determine the corresponding second file when multiple first files exist at the same time.

[0021] In a possible implementation, the second file is an executable file of the first file, and the processing module is further used to execute the second file based on the file path information of the second file, so that the second file runs the first file. Through the above technical solution, the executable file of the first file can be accurately and concisely determined, and the first file can be run quickly and efficiently through the second file.

[0022] In a possible implementation, the processing module is further used to obtain the file path information of the second file in response to the second operation of the user; and store the file path information of the second file in the storage area corresponding to the file extension attribute block of the first file. Through the above technical solution, the association relationship between the first file and the second file can be accurately recorded through the storage area corresponding to the file extension attribute block of the first file.

[0023] In a possible implementation, the processing module is further used to determine the index node corresponding to the first file according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block; and the extended attribute information of the first file is obtained from the data block according to the pointer. Through the above technical solution, the association relationship between the first file and the second file can be bound through the extended attribute information of the first file, so as to facilitate the accurate acquisition of the second file based on the first file.

[0024] In a possible implementation, the first operation includes inputting a first instruction, the first instruction includes the file information of the first file, or the first operation is a click operation on the first file. In a fourth aspect, the present application provides a file processing device, including: an acquisition module, for acquiring the file information of the first file and the file path information of the second file in response to the second operation of the user, wherein the file information of the first file corresponds to the storage area of ​​the file extension attribute of the first file; a processing module, for storing the file path information of the second file in the storage area of ​​the file extension attribute of the first file; wherein the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file. Through the above technical solution, the extended attributes of the first file can be set, the file information of the corresponding second file can be recorded, and the association relationship between the first file and the second file can be established, so as to facilitate the accurate processing of the second file according to the extended attributes of the first file.

[0025] In a fifth aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the file processing method as described in any one of the above items when executing the computer program.

[0026] In a sixth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the file processing method as described above is implemented.

[0027] In the seventh aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program runs on a processor, the processor executes the file processing method described in the first aspect, the second aspect, or any possible implementation of the first aspect.

[0028] In the file processing method provided in the present application, the file information of the first file is obtained in response to the first operation of the user; based on the file information of the first file, the extended attribute information of the first file is obtained, and the extended attribute information includes the file path information of the second file; the second file is processed based on the file path information of the second file. The association relationship between the first file and the second file can be accurately recorded through the extended attribute information of the first file, and the second file corresponding to the first file can be accurately found through the association relationship. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of an application scenario of the file processing method provided in an embodiment of the present application.

[0030] Figure 2 It is a schematic diagram of the structure of the file system provided in the embodiment of the present application.

[0031] Figure 3 It is a flowchart of the file processing method provided in an embodiment of the present application.

[0032] Figure 4 This is a flowchart of a file processing method provided by another embodiment of the present application.

[0033] Figure 5 This is a flowchart of a file processing method provided by another embodiment of the present application.

[0034] Figure 6 This is a flowchart of a file processing method provided by another embodiment of the present application.

[0035] Figure 7 This is a flowchart of a file processing method provided by another embodiment of the present application.

[0036] Figure 8 This is a flowchart of a file processing method provided by another embodiment of the present application.

[0037] Fig. 9 This is a flowchart of a file processing method provided by another embodiment of the present application.

[0038] Fig.10 It is a structural diagram of a file processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] To facilitate understanding, some descriptions of concepts related to the embodiments of the present application are given exemplarily for reference.

[0040] It should be noted that in this application, "at least one" refers to one or more, and "more than one" refers to two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. For ease of understanding, the technical terms involved in the embodiments of the present application will be introduced below.

[0041] (1) File system (FS)

[0042] The file system is the method used by the operating system to identify files on a storage device or partition, that is, the method of organizing files on a storage device. Generally speaking, the software organization responsible for managing and storing file information in the operating system is called a file management system, or file system for short. From a system perspective, a file system is a system that organizes and allocates space on a storage device, is responsible for file storage, and protects and retrieves stored files. Specifically, the file system is responsible for creating files for users, storing files, reading files, modifying files, dumping files, undoing files, and controlling file access.

[0043] (2) Extended attribute (EA)

[0044] Extended attributes are a functional mechanism of the file system. Users can record the metadata corresponding to a file by using the extended attributes of the file. Metadata is a type of information used to describe the attributes of a file. Exemplarily, the extended attributes of a file indicate the metadata corresponding to the file in the form of a name-value pair.

[0045] In the LINUX system, a special command can be used to view or set the extended attributes of a file. For example, in the network file protocol, the Server Message Block (SMB) protocol can query and set the extended attributes of a file through the File_Full_Ea_Information subcommand of the query information (QUERY_INFO) and the set information (SET_INFO).

[0046] (3) Storage devices

[0047] Storage devices refer to devices that provide file storage functions. On most storage devices, network protocol interfaces such as Network File System (NFS) and Server Message Block (SMB) are provided to facilitate other devices to access files through network protocol interfaces. Exemplarily, a storage device is, for example, a storage array. Among them, the storage array is composed of a large number of storage units, and a large number of storage units are arranged in the form of an N-row × M-column matrix. In simple terms, a storage array actually combines multiple disks into an array and uses them as a single disk. The storage array stores data in different disks in a segmented manner. When accessing data, the related disks in the storage array act together, which greatly reduces the access time of data and has better space utilization.

[0048] The above introduces the technical terms involved in the embodiments of the present application. The following will introduce the application scenarios of the file processing method provided by the embodiments of the present application. Figure 1As shown, the file processing method is applied to a computer device 1. In the embodiment of the present application, the computer device 1 can be a computer, a server, a smart screen, a mobile phone, a tablet computer, a smart wearable device, an augmented reality (AR) / virtual reality (VR) device, a laptop, a netbook, an energy storage device, a power distribution device, a vehicle-mounted device, a self-moving device, etc. The embodiment of the present application does not impose any restrictions on the specific type of the computer device.

[0049] The following first describes the specific structure of the computer device. Figure 1 FIG. 1 is a schematic diagram of the structure of a computer device 1 provided in an embodiment of the present application. The computer device 1 includes, but is not limited to, Figure 1 As shown, the computer device 1 may include a memory 101, a processor 102, an input / output (I / O) interface 103 and a bus 104. The processor 102 is coupled to the memory 101 and the I / O interface 103 through the bus 104.

[0050] The memory 101 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM). The random access memory can be directly read and written by the processor 102, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0051] Random access memory may include static random-access memory (SRAM), dynamic random-access memory (DRAM), synchronous dynamic random-access memory (SDRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.

[0052] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 102. The non-volatile memory may include a disk storage device and a flash memory.

[0053] The memory 101 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 102. The one or more computer programs include multiple instructions, and when the multiple instructions are executed by the processor 102, the data processing method executed on the computer device 1 can be implemented.

[0054] In other embodiments, the computer device 1 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the computer device 1 .

[0055] The processor 102 may include one or more processing units, for example, the processor 102 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0056] The processor 102 provides computing and control capabilities. For example, the processor 102 is used to execute a computer program stored in the memory 101 to implement the above-mentioned data transmission method.

[0057] The I / O interface 103 is used to provide a channel for user input or output. For example, the I / O interface 103 can be used to connect various input and output devices, such as a mouse, keyboard, touch screen, etc., so that the user can enter information or visualize information.

[0058] The bus 104 is at least used to provide a channel for mutual communication among the memory 101 , the processor 102 , and the I / O interface 103 in the computer device 1 .

[0059] It is understandable that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the computer device 1. For example, the computer device 1 may also include a wireless communication module (not shown in the figure), which may provide one or more wireless communication solutions such as wireless fidelity (Wireless Fidelity, Wi-Fi), Bluetooth (Bluetooth, BT), mobile communication network, frequency modulation (Frequency Modulation, FM), near field communication technology (Near Field Communication, NFC), infrared technology (Infrared, IR), etc. The computer device 1 may also include a file system (such as Figure 2 As shown), the file system is used to manage and organize files and directories. Files and directories can be organized on the memory 101 and provide operations such as access, read, write, modify, and delete.

[0060] In other embodiments of the present application, the computer device 1 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0061] In order to better understand the file processing method provided by this application, the structure of the file system is introduced below. Figure 2 As shown, the file system 105 includes an index node area 1051 and a data block area 1052. The index node area 101 includes a plurality of index nodes. Figure 2 As shown in , the index node area 1051 includes index node 1, index node 2, ... index node N. The index node records the file information of the file, including access control information, data organization information and extended attribute block (EAB). Among them, the access control information may include owner information, group information, the time of the last modification of the file, the time of the last modification of the file attribute, the time of the last access to the file, access rights, etc. The data organization information may include the address of the data block, file data encryption and decryption information, file size, indirect index node address, etc. The extended attribute block is a field in the index node, and the extended attribute block can store pointers to the data blocks in the data block area 1012.

[0062] In one embodiment, the index node of a file may occupy the size of a block, wherein the size of a block may be 4KB, that is, 4096 bytes.

[0063] The data block area 1052 includes a plurality of data blocks. Figure 2As shown in , the data block area 1012 includes data block 1, data block 2 ... data block M ... data block N. The data block can store various information of the file, such as the extended attributes of the file and the content of the file.

[0064] In some embodiments, the file system 105 may also include a super block (not shown in the figure). The super block is located in the first block of the file system 105, and the data stored in the super block is the control information of the file system 105. It includes the directory entry of the file system 105. The directory entry is organized in a tree topology to form a directory tree used by users, providing the service with the function of accessing files through paths. The data blocks in the data block area 1052 are used to store the content of the file. The index node area 1051 stores the directory entry and the index node corresponding to each file. The attributes and storage address of the file are also stored in the index node, and the storage address points to the data block storing the content of the file. When performing file retrieval, the directory entry in the super block can be used to retrieve the full path file name as a keyword through the directory entry level by level.

[0065] The technical solution of the present application is described in detail below with specific embodiments. The specific embodiments described below may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0066] Figure 3 The following is a flowchart of a file processing method provided in an embodiment of the present application, and the file processing method is applied in a computer device. Figure 3 As shown, the file processing method may include:

[0067] Step S301: In response to a first operation of a user, file information of a first file is obtained.

[0068] In an embodiment of the present application, when a user needs to use a first file, the computer device obtains file information of the first file in response to a first operation of the user on the first file. The first operation includes inputting a first instruction. For example, a get instruction is input in a command box. The first instruction includes file information of the first file, wherein the file information of the first file includes one or more of a file name and a file path of the first file. The first operation may also include a click operation on the first file, wherein the click operation includes a single-click operation and / or a double-click operation. The file may be opened or selected by the click operation on the first file.

[0069] Step S302: based on the file information of the first file, obtaining the extended attribute information of the first file, wherein the extended attribute information of the first file includes the file path information of the second file.

[0070] In an embodiment of the present application, based on the file information of the first file, obtaining the extended attribute information of the first file includes: determining the index node corresponding to the first file according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to the data block; obtaining the extended attribute information of the first file from the data block according to the pointer.

[0071] In the embodiment of the present application, the data block stores the extended attribute of the first file, and the extended attribute records the file information of the second file. Therefore, the association relationship between the first file and the second file can be established through the extended attribute.

[0072] In an embodiment of the present application, the index node records relevant metadata of the first file, including but not limited to: owner information of the first file, group information of the first file, time of the last modification of the first file, time of the last modification of the attributes of the first file, time of the last access to the first file, access rights of the first file, and extended attribute block of the first file.

[0073] In some embodiments, the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file. The above relationship between the first file and the second file is an example and is not limited in actual application.

[0074] In one embodiment, if the first file is a backup file of the second file. Assume that the file name of the second file is myfile, and the file path is / a / b / myfile; the file name of the first file is myfile.bak, and the file path is / a / b / myfile.bak. Then, based on the file name of the first file and the file name of the second file, an association relationship between the two can be established, and the first file is a backup file of the second file. When the first file and the second file are stored in the same location of the storage device, the association relationship between the first file and the second file can be determined based on the file path. For example, the file path of the first file is / a / b / myfile.bak; the file path of the second file is / a / b / myfile, and it can be determined that the first file is a backup file of the second file. When the first file and the second file are stored in different locations of the storage device, and there are files with the same file name as the first file or the second file in different locations, it is difficult to determine the association relationship between the first file and the second file, and the backup file of the second file cannot be accurately found, which is prone to file confusion. For example, the file path of the first file is / a / b / myfile.bak; the file path of the second file is / c / d / myfile, and there is a file named myfile.bak under the file path of the second file. Then, it is very easy to mistakenly determine that the file named myfile.bak is the backup file of the second file. In order to solve this problem, the extended attribute of the first file can be set, and the association relationship between the first file and the second file can be recorded through the extended attribute.

[0075] In some embodiments, when the first file is a backup file of the second file, the extended attribute information of the first file includes at least one of the following information: a universally unique identifier (UUID) of the disk device where the second file is located, a modification time of the second file, and file path information of the second file.

[0076] In some embodiments, when the first file is a signature file of the second file, the extended attribute information of the first file includes at least one of the following information: a universal unique identifier of the disk device where the second file is located, and file path information of the second file.

[0077] In some embodiments, when the first file is a deleted second file, the extended attribute information of the first file includes at least one of the following information: a universal unique identifier of the disk device where the second file is located, a time when the second file is modified, and file path information of the second file.

[0078] In some embodiments, when the first file is a file generated after the second file runs abnormally, the extended attributes of the first file include at least: file path information of the second file. The first file is a core dump file generated when an exception occurs when executing the second file. A core dump file is a file generated by a computer system when a program crashes or terminates abnormally, and may at least contain the memory content of the program when it crashes or terminates abnormally.

[0079] In some embodiments, when the first file is a data file and the second file is an executable file of the first file, the extended attribute of the first file includes at least: file path information of the second file. Specifically, the second file is an executable file corresponding to an application program that operates the first file.

[0080] In some embodiments, when the file system includes an extended attribute block, due to the limited capacity of the extended attribute block, it is impossible to record the association relationship between all files in the file system. The data recorded in the extended data block can be compressed by a data compression technology. Since the pointer pointing to the data block recorded by the extended attribute block can be in any form, compressing the data recorded in the extended data block by a data compression technology will not cause data loss.

[0081] Step S303: Process the second file based on the file path information of the second file.

[0082] In an embodiment of the present application, the second file can be obtained according to the association relationship, and related operations can be performed on the second file. Specifically, after the association relationship between the first file and the second file is obtained according to the extended attribute information of the first file, the second file can be processed based on the file path information of the second file.

[0083] In an embodiment of the present application, if the first file is a backup file of the second file, processing the second file based on the file path information of the second file includes: copying the first file, saving the copied first file according to the file path information of the second file to restore the second file.

[0084] In an embodiment of the present application, if the first file is a file after the second file is moved to a trash folder, processing the second file based on the file path information of the second file includes: moving the first file to the file path corresponding to the file path information of the second file to restore the second file.

[0085] In an embodiment of the present application, if the first file is a signature file of the second file, processing the second file based on the file path information of the second file includes: obtaining the second file based on the file path information of the second file; and sending the first file and the second file.

[0086] In an embodiment of the present application, if the first file is a file generated after the second file runs abnormally, processing the second file based on the file path information of the second file includes: displaying the second file based on the file path information of the second file.

[0087] In an embodiment of the present application, if the second file is an executable file of the first file, processing the second file based on the file path information of the second file includes: executing the second file based on the file path information of the second file so that the second file runs the first file.

[0088] In some embodiments, the file processing method further includes: in response to a second operation of the user, obtaining the file path information of the second file; storing the file path information of the second file in a storage area corresponding to the file extension attribute block of the first file. The extended attribute of the first file is set by storing the file path information of the second file in a storage area corresponding to the file extension attribute block of the first file, and the extended attribute of the first file indicates the metadata corresponding to the first file in the form of a key-value pair. Specifically, the extended attribute of the first file may include an extended attribute name and an extended attribute value. For example, assuming that the first file is a backup file obtained by copying the second file, for the extended attribute of the first file, the extended attribute name of the first file can be set to "user.backup_orig", and the extended attribute value of the first file can be set to "uuid0; path / to / origin; modtime". Among them, back is the file name of the second file, uuid0 represents the universal unique identifier of the storage device where the second file is located; path / to / origin represents the path of the second file stored in the storage device, and modtime represents the time when the second file is modified.

[0089] In some embodiments, the extended attributes of the first file may be set by an application that requests to store the first file. When the first file is a file that has been stored in a storage device, the application may send a request to the storage device to request the storage device to set the extended attributes of the first file. For example, the storage device obtains a preset request from the application, the preset request is used to request to set the extended attributes of the first file, and the preset request includes the extended attributes of the first file; the storage device obtains the extended attributes of the first file according to the preset request. The preset request may carry the extended attribute name and extended attribute value of the first file. In this way, the storage device can set the extended attributes of the first file based on the extended attribute name and extended attribute value in the preset request.

[0090] In some embodiments, a user may input a preset instruction through a computer device to set the extended attributes of the first file. Exemplarily, in a user interface of a computer device, a user may instruct a storage device to set the extended attributes of the first file by inputting a preset instruction on the user interface. The preset instruction input by the user may be an instruction to instruct the storage device to batch modify the extended attributes of files, and the first file belongs to multiple files whose extended attributes are modified in batches; the preset instruction input by the user may also be an instruction to instruct the storage device to modify the extended attributes of a specific file (e.g., the first file). Alternatively, a user may instruct the storage device to set the extended attributes of the first file by inputting a command line to the storage device. The preset instruction input by the user includes one or more character strings. Based on the preset instruction, the storage device determines that the extended attributes of the first file are one or more character strings. For example, the preset instruction includes character string 1 and character string 2, and the storage device may determine that the name of the extended attribute in the extended attributes of the first file is character string 1, and the extended attribute value is character string 2 based on the preset instruction.

[0091] In an embodiment of the present application, by setting the extended attributes of the first file, recording the file information of the corresponding second file, and establishing an association relationship between the first file and the second file, the second file corresponding to the first file can be accurately found and processed through the association relationship, thereby avoiding file confusion.

[0092] Figure 4 The following is a flowchart of a file processing method provided in an embodiment of the present application, and the file processing method is applied in a computer device. Figure 4 As shown, the file processing method may include:

[0093] Step S401, in response to a second operation of the user, obtaining file information of a first file and file path information of a second file, wherein the file information of the first file corresponds to a storage area of ​​a file extension attribute of the first file.

[0094] In an embodiment of the present application, after setting the extended attribute of the first file, when the user needs to use the first file, the computer device obtains the file information of the first file and the file path information of the second file in response to the second operation on the first file. The file information of the first file corresponds to the storage area of ​​the file extended attribute of the first file. The second operation may include but is not limited to: opening a file and selecting a file. For example, in response to the operation of opening the first file, the corresponding index node can be obtained according to the file name of the first file. For another example, in response to the operation of selecting the first file, the corresponding index node can be obtained according to the file name of the first file.

[0095] Step S402: Store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0096] In an embodiment of the present application, after obtaining the file information of the first file and the file path information of the second file, the file path information of the second file is stored in the storage area of ​​the file extension attribute of the first file to establish an association relationship between the first file and the second file. Specifically, in response to the second operation on the first file, a corresponding index node can be obtained according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to the storage area, and the information recorded in the storage area can be read according to the pointer. Therefore, it is necessary to store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0097] In the embodiment of the present application, the index node records the file information of the second file, including but not limited to: the owner information of the second file, the group information of the second file, the time when the second file was last modified, the time when the attribute of the second file was last modified, the time when the second file was last accessed, the access rights of the second file, and the extended attribute block of the second file. The extended attribute block records the pointer to the data block.

[0098] In some embodiments, when the file system includes an extended attribute block, due to the limited capacity of the extended attribute block, it is impossible to record the association relationship between all files in the file system. The data recorded in the extended data block can be compressed by a data compression technology. Since the pointer to the data block recorded by the extended attribute block can be in any form, compressing the data recorded in the extended data block by a data compression technology will not cause data loss. In an embodiment of the present application, the extended attribute of the first file is stored in the data block, and the extended attribute records the file information of the second file. Therefore, the association relationship between the first file and the second file can be established through the extended attribute. In some embodiments, the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file. The above relationship between the second file and the first file is an example, and is not limited in actual application. Through the embodiment of the present application, the extended attribute of the first file can be set, the file information of the corresponding second file can be recorded, and the association relationship between the first file and the second file can be established, so as to facilitate accurate processing of the second file according to the extended attribute of the first file.

[0099] In an embodiment of the present application, the first file may be an original file or a file obtained based on the original file; the second file may be an original file or a file obtained based on the original file, and the present application does not limit this.

[0100] Figure 5This is another flowchart of a file processing method provided in an embodiment of the present application, and the file processing method is applied in a computer device. Figure 5 As shown, the file processing method may include:

[0101] Step S501: in response to a second operation, copy a second file to obtain a first file.

[0102] In one embodiment, in an application scenario of backup files, in response to a second operation performed by a user on a second file, the second file is copied to obtain a first file, wherein the second operation is a copy operation, the second file is a source file, and the first file is a backup file of the second file.

[0103] Step S502: Obtain file information of the first file and file path information of the second file.

[0104] In the embodiment of the present application, after obtaining the first file, the file information of the first file and the file path of the second file can be obtained, and the index node corresponding to the first file can be determined according to the file path of the second file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block. The data block stores the extended attributes of the first file, and the extended attributes record the file information of the second file.

[0105] Step S503: Store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0106] In an embodiment of the present application, there are certain limitations in determining the association between the first file and the second file by file name. For example, when the first file and the second file have different file paths, it is very easy to fail to accurately find the backup file of the second file. The file information of the second file can be recorded by setting the extended attributes of the first file, and the file information of the first file corresponds to the storage area of ​​the file extended attributes of the first file. The association between the first file and the second file is established through the extended attributes of the first file. Among them, the file information of the first file includes the file name of the first file and / or the file path of the first file; the file information of the second file includes at least: the UUID of the disk device where the second file is located, the file path information of the second file, and the time when the second file was modified.

[0107] In some embodiments of the present application, it is assumed that the second file is the original file, which can be named origin; the first file is the backup file, which can be named bak. In response to the operation of copying the original file, a backup file is obtained; the UUID of the disk device where the original file is located is obtained, and is set to uuid0; the file path of the original file in the disk device is obtained, and is set to path / to / origin; the modification time of the original file is obtained, and is set to modtime; based on the UUID of the original file, the file path of the original file, and the modification time of the original file, the extended attributes of the backup file are set to user.backup_orig through the setfattr command. For example, the setfattr command is: setfattr-n user.backup_orig-v"uuid0;path / to / origin;modtime"bak. Among them, -n user.backup_orig means setting the name of the extended attribute of the backup file to user.backup_orig, and -v"uuid0;path / to / origin;modtime" means setting the extended attributes of the backup file to "uuid0;path / to / origin;modtime". Thus, the file path information of the second file is stored in the storage area of ​​the file extension attribute of the first file, and an association relationship between the first file and the second file is established.

[0108] Step S504: in response to a first operation of the user, obtaining file information of a first file.

[0109] In an embodiment of the present application, after establishing an association relationship between a first file and a second file, the second file corresponding to the first file can be accurately determined according to the association relationship. Specifically, in response to a first operation of a user on a first file, file information of the first file is obtained. In response to the first operation on the first file, a corresponding index node is obtained according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block.

[0110] In some embodiments of the present application, in response to the operation of opening a backup file, the corresponding index node can be obtained according to the file name of the backup file. Figure 2 As shown, the index node N is obtained according to the file name of the backup file being myfile.bak. The index node N includes an extended attribute block, and the extended attribute block records a pointer (eg, M) pointing to a data block.

[0111] Step S505: based on the file information of the first file, obtain the extended attribute information of the first file, where the extended attribute information includes the file path information of the second file.

[0112] In the embodiment of the present application, the data block M is determined to be a data block recording the extended attribute of the first file according to the pointer, and the extended attribute of the first file in the data block M is read, wherein the extended attribute information includes the file path information of the second file. Figure 2 The extended attribute 2 in: user.origin = " / path / to / original / file". The file path of the second file on the disk device can be determined according to the extended attribute 2, so that the second file corresponding to the first file can be accurately read according to the file path to find the original file corresponding to the backup file.

[0113] Step S506: Save the copied first file according to the file path information of the second file to restore the second file.

[0114] In some embodiments of the present application, the copied original file is saved according to the file path information of the second file to facilitate subsequent restoration of the second file.

[0115] In an embodiment of the present application, by setting the extended attribute of the backup file (user.backup_orig), the original file can be associated with the backup file and the storage location of the original file can be tightly bound. The modification time and other information of the original file can be recorded in the extended attribute, which is conducive to accurate recovery of the original file.

[0116] Figure 6 This is another flowchart of a file processing method provided in an embodiment of the present application, and the file processing method is applied in a computer device. Figure 6 As shown, the file processing method may include:

[0117] Step S601, in response to the second operation, signing the second file to generate the first file.

[0118] In one embodiment, in an application scenario of signing a file, in response to a signing operation, the second file is signed, and based on the signed second file, a first file is generated. The first file is a signature file of the second file.

[0119] Step S602: Obtain file information of the first file and file path information of the second file.

[0120] In the embodiment of the present application, after obtaining the first file, the file information of the first file and the file path of the second file can be obtained, and the index node corresponding to the first file can be determined according to the file path of the second file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block. The data block stores the extended attributes of the first file, and the extended attributes record the file information of the second file.

[0121] Step S603: Store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0122] In some embodiments of the present application, after signing the second file, it is necessary to record the file path of the original file (e.g., the second file) in the signature file (e.g., in the first file). The file information of the second file can be recorded by setting the extended attributes of the first file. Specifically, the extended attributes of the first file are set by storing the file path information of the second file in the storage area of ​​the file extended attributes of the first file, wherein the extended attributes record the file information of the second file. The file information of the second file includes at least: the UUID of the disk device where the second file is located and the file path of the second file on the disk device.

[0123] In an embodiment of the present application, it is assumed that the second file is an original file, which can be named origin, and the first file is a signature file, which can be named signature. In response to the signature operation performed on the original file, a signature file is generated; the UUID of the storage device where the original file is located is obtained, and is set to uuid0; the file path of the original file in the storage device is obtained, and is set to path / to / origin; based on the UUID of the original file and the file path of the original file, an extended attribute is set for the signature file through the setfattr command, and is set to user.sig_orig. For example, the setfattr command is: setfattr-n user.sig_orig-v"uuid0;path / to / origin"signature. Among them, -n user.sig_orig means setting the name of the extended attribute of the signature file to user.sig_orig, and -v"uuid0;path / to / origin" means setting the extended attribute of the signature file to "uuid0;path / to / origin". During the digital signature process, recording the UUID of the original file can increase the credibility of the signature, prevent the signed file from being tampered with or moved to other devices for execution, and ensure the validity of the signature.

[0124] Step S604: in response to a first operation of the user, obtaining file information of a first file.

[0125] In an embodiment of the present application, after establishing an association relationship between a first file and a second file, the second file corresponding to the first file can be accurately determined according to the association relationship. Specifically, in response to a first operation of a user on a first file, file information of the first file is obtained. In response to the first operation on the first file, a corresponding index node is obtained according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block.

[0126] In some embodiments of the present application, in response to the first operation of verifying the signature file, a corresponding index node may be obtained according to the file name of the signature file, and a pointer recording the data block may be obtained according to the index node.

[0127] Step S605: based on the file information of the first file, obtaining the extended attribute information of the first file, where the extended attribute information includes the file path information of the second file.

[0128] In some embodiments of the present application, the data block M is determined to be a data block recording the extended attributes of the signature file according to the pointer, and the extended attribute value of the extended attribute of the signature file in the data block M is obtained, for example, -v "uuid0; path / to / origin". The file path on the disk device where the original file corresponding to the signature file is located can be obtained according to the extended attribute value, such as path / to / origin. The original file can be obtained according to the path. The UUID of the disk device where the original file corresponding to the signature file is located can also be obtained according to the extended data, for example, uuid0.

[0129] Step S606: acquiring the second file based on the file path information of the second file, and sending the first file and the second file.

[0130] In the embodiment of the present application, after the second file is obtained through the file path of the second file, the first file and the second file may be sent to the recipient.

[0131] In the embodiment of the present application, by setting the extended attributes of the signature file, the storage location of the original file can be tightly bound, which is conducive to archiving and managing the signature file.

[0132] Figure 7 The flowchart of another file processing method provided in the embodiment of the present application is shown in FIG. Figure 7 As shown, the file processing method may include:

[0133] Step S701, in response to the second operation, moving the second file to the first address indicated by the preset path to obtain the first file under the preset path.

[0134] In one embodiment, in an application scenario of deleting a file, it is generally not necessary to completely delete the file from the disk, but to move the file to a first address indicated by a preset path, such as a trash can or a recycle bin. In response to an operation of moving a second file to the first address or an operation of deleting the second file, a first file under the preset path is obtained. The preset path may be a file path corresponding to a trash can application or a recycle bin application, and the second file is the source file of the first file.

[0135] Step S702: Obtain file information of the first file and file path information of the second file.

[0136] In the embodiment of the present application, after obtaining the first file, the file information of the first file and the file path of the second file can be obtained, and the index node corresponding to the first file can be determined according to the file path of the second file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block. The data block stores the extended attributes of the first file, and the extended attributes record the file information of the second file.

[0137] Step S703: Store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0138] In an embodiment of the present application, after moving the second file to the first address, it is generally necessary to record the file path of the moved second file through other independent files. Then, when restoring the second file, it is necessary to parse the entire independent file, which reduces the execution efficiency. In order to facilitate the subsequent recovery of the deleted second file, the file information of the first file and the file path information of the second file can be obtained, and the index node corresponding to the first file can be determined according to the file path information of the second file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to the data block. The extended attributes of the first file are stored in the data block, and the extended attributes record the file information of the second file. The file path of the second file before deletion is recorded through the extended attributes of the first file, and an association relationship between the first file and the second file is established.

[0139] In some embodiments of the present application, it is assumed that the second file is an original file, which can be named origin; the first file is the second file after deletion. The file path (oldpath) of the original file and the modification time (modtime) of the original file are obtained; in response to the operation of moving the original file to the trash directory, the deleted original file is obtained, and its file name is devno-modtime.deleted; based on the file path and modification time of the original file, the extended attribute is set for the deleted original file through the setfattr command, and is set to user.del_orig. For example, the setfattr command is: setfattr-nuser.del_orig-v"oldpath"devno-modtime.deleted. Among them, -n user.del_orig means setting the extended attribute name of the deleted original file to user.del_orig, and -v"oldpath"devno-modtime.deleted means setting the extended attribute of the deleted original file to "oldpath"devno-modtime.deleted. Thereby, the file path information of the second file is stored in the storage area of ​​the file extension attribute of the first file, and the association relationship between the first file and the second file is established.

[0140] Step S704: in response to a first operation of the user, obtain file information of the first file.

[0141] In an embodiment of the present application, after establishing an association relationship between a first file and a second file, the second file corresponding to the first file can be accurately determined according to the association relationship. Specifically, in response to a first operation of a user on a first file, file information of the first file is obtained. In response to the first operation on the first file, a corresponding index node is obtained according to the file information of the first file, wherein the index node includes an extended attribute block, and a pointer to a data block is recorded in the extended attribute block.

[0142] In some embodiments of the present application, when a user needs to restore a second file, the computer device obtains a corresponding index node according to the file information of the first file in response to a first operation on the first file.

[0143] Step S705: based on the file information of the first file, obtain the extended attribute information of the first file, where the extended attribute information includes the file path information of the second file.

[0144] In some embodiments of the present application, the file path oldpath of the original file can be obtained by reading the extended attribute recorded in the data block, for example, reading the extended attribute user.del_orig set for the original file after deletion.

[0145] Step S706: Move the first file to the file path corresponding to the file path information of the second file to restore the second file.

[0146] In some embodiments of the present application, the first file is moved to the second address according to the extended attribute information of the first file to restore the second file. The second address is the file path corresponding to the file path information of the second file. Specifically, based on the file information of the second file recorded in the extended attribute, the association relationship between the first file and the second file can be obtained, and the file path of the second file before deletion is obtained by the first instruction and set to myoldpath; the first file is moved to the file path myoldpath of the second file by the second instruction. The first instruction is getfattr--only-values-nuser.del_orig devno-modtime.deleted; the second instruction is mv devno-modtime.deletedmyoldpath. In this way, the first file after deletion can be restored to obtain the second file.

[0147] In some embodiments, the extended attribute of the recorded file path myoldpath may also be deleted by a third instruction, wherein the third instruction is setfattr-x user.del_orig myoldpath.

[0148] In the embodiment of the present application, by setting the extended attribute of the deleted second file, the file path of the second file before deletion can be accurately recorded. Because the extended attribute of the second file is closely tied to the first file, the original path of the second file can be saved more safely and reliably, and the method for obtaining the original path is also simpler.

[0149] Figure 8 The flowchart of another file processing method provided in the embodiment of the present application is shown in FIG. Figure 8 As shown, the file processing method may include:

[0150] Step S801: When an exception occurs during the execution of the second file, a first file is generated.

[0151] In an embodiment of the present application, the second file is an executable file, and the first file is a core dump file. In the process of executing the second file through a process, if an exception occurs in the process, the operating system generates a core dump file to record the on-site information when the exception occurs, so as to analyze the cause of the exception. The operating system generally saves the core dump file under a specific file path. Specifically, the operating system can set the name format of the generated core dump file through a configuration file (such as / etc / sysctl.conf or / proc / sys / kernel / core_pattern). For example, the default name format of the coredump file is "core-%e-%p-%s-%t-%e", where %e represents the name of the executable file.

[0152] Step S802: In response to a second operation of the user, obtain file information of the first file and file path information of the second file.

[0153] In the embodiment of the present application, after obtaining the first file, the file information of the first file and the file path of the second file can be obtained, and the index node corresponding to the first file can be determined according to the file path of the second file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block. The data block stores the extended attributes of the first file, and the extended attributes record the file information of the second file.

[0154] Step S803: Store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0155] In an embodiment of the present application, since the file name of the executable file in the operating system does not include the file path of the executable file, it is easy to have a problem of not being able to determine which executable file a core dump file corresponds to for executable files with the same name in different file paths. The executable file corresponding to the process that generates the exception can be recorded by setting the extended attributes of the core dump file. The extended attributes of the first file are set by storing the file path information of the second file in the storage area of ​​the file extended attributes of the first file, wherein the extended attributes record the file information of the second file, so that the file path of the executable file corresponding to the first file can be accurately recorded, avoiding the problem of confusion of the corresponding executable files when multiple first files exist at the same time.

[0156] Step S804: in response to a first operation of the user, obtaining file information of a first file.

[0157] In an embodiment of the present application, after establishing an association relationship between a first file and a second file, the second file corresponding to the first file can be accurately determined according to the association relationship. Specifically, in response to a first operation of a user on a first file, file information of the first file is obtained. In response to the first operation on the first file, a corresponding index node is obtained according to the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block.

[0158] In response to a first operation on a first file, a corresponding index node is obtained according to file information of the first file, wherein the index node includes an extended attribute block, and a pointer to a data block is recorded in the extended attribute block.

[0159] In an embodiment of the present application, in response to a selection operation on a core dump file, a corresponding index node can be obtained according to the file name of the core dump file, wherein the index node includes an extended attribute block, and a pointer to a data block is recorded in the extended attribute block.

[0160] Step S805: based on the file information of the first file, obtain the extended attribute information of the first file, where the extended attribute information includes the file path information of the second file.

[0161] In an embodiment of the present application, the extended attribute of the core dump file recorded in the data block is read according to the pointer to obtain the file path of the executable file corresponding to the core dump file. The association relationship between the first file and the second file can be established through the extended attribute to obtain the executable file corresponding to the core dump file according to the association relationship.

[0162] Step S806: display the second file based on the file path information of the second file.

[0163] In the embodiment of the present application, the second file is displayed based on the file path information of the second file, so that the user can read the second file and find the reason why the second file is abnormal.

[0164] In an embodiment of the present application, the file path of the executable file corresponding to the core dump file can be accurately recorded through the extended attribute (user.exe_orig) of the core dump file, avoiding the problem of being unable to determine the corresponding executable file when multiple core dump files exist at the same time.

[0165] In the embodiment of the present application, the file processing method further includes: a step of sending the first file to the electronic device. By sending the first file to the electronic device, the analyst can obtain the original executable file according to the extended attribute of the first file.

[0166] Fig. 9This is another flowchart of a file processing method provided in an embodiment of the present application, and the file processing method is applied in a computer device. Fig. 9 As shown, the file processing method may include:

[0167] Step S901: In response to a selection operation performed on a second file, file path information of the second file is obtained.

[0168] Step S902: Store the file path information of the second file in the storage area of ​​the file extension attribute of the first file.

[0169] In an embodiment of the present application, the operating system includes a variety of data files, and each data file can be associated with a corresponding application to open and use the data file. For example, for files with an extension of .c, they are often associated with an editor for encoding; for files with an extension of .doc, they are associated with word or wps to open and edit the file in a word or wps environment; for video files with an extension of .3gp or .mpg, they can be associated with players such as vmplayer to play the file. Because the file extension may not reflect the file type, the method of associating the corresponding application through the file extension may result in the association of the wrong application. In response to the selection operation performed on the second file, the file path information of the second file is obtained, and the file path information of the second file is stored in the storage area of ​​the file extension attribute of the first file. The extended attribute of the first file is set, so that when operating the second file, the executable file of the application corresponding to the second file can be accurately obtained.

[0170] In one embodiment, in response to an operation of selecting a data file (e.g., mydatafile), an extended attribute is set based on the data file. For example, an extended attribute is set for the data file by a setfattr command, and is set to user.opener. For example, the setfattr command is: setfattr -n user.opener -v "exepath" mydatafile. Among them, -nuser.opener means setting the extended attribute name of the data file to user.opener, and -v "exepath" mydatafile means setting the extended attribute of the data file to "exepath". Among them, exepath records the file path of the executable file of the application corresponding to the data file.

[0171] Step S903: In response to a first operation of the user, obtain file information of the first file.

[0172] Step S904: based on the file information of the first file, obtain extended attribute information of the first file, where the extended attribute information includes file path information of the second file.

[0173] In an embodiment of the present application, in response to a first operation of a user, file information of a first file is obtained, and a corresponding index node is obtained according to the file information of the first file, wherein the index node includes an extended attribute block, and a pointer to a data block is recorded in the extended attribute block. The extended attribute information of the first file recorded in the data block is read according to the pointer, for example, user.opener. The extended attribute information of the first file includes file path information of the second file.

[0174] Step S905: Execute the second file based on the file path information of the second file, so that the second file runs the first file.

[0175] In the embodiment of the present application, the second file is executed according to the file path information of the second file, so that the second file runs the first file. The first file (for example, an executable file) of the application corresponding to the open data file is obtained from the extended attribute according to the association relationship. For example, through the instruction getfattr--only-values-n user.openermydatafile, the executable file myexe of the application corresponding to the open data file is obtained; with mydatafile as a parameter, the executable file is called (for example: myexe mydatafile), and the data file is opened through the executable file.

[0176] In the embodiment of the present application, by setting the extended attribute (user.opener) of the data file, the file path of the executable file of the application corresponding to the data file can be set in a refined manner. Since it is cumbersome to set the opening method for each data file, the use of the extended attribute can accurately and concisely determine the executable file of the application corresponding to the data file.

[0177] Fig.10 1 is a structural diagram of a file processing device provided in an embodiment of the present application. The file processing device 100 may include a plurality of functional modules composed of computer program segments. The computer programs of the various program segments in the file processing device 100 may be stored in a memory of a computer device and executed by at least one processor to execute (see Figure 3-Figure 9 Description) File processing functions.

[0178] In this embodiment, the file processing device 100 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: an acquisition module 1001 and a processing module 1002. The module referred to in this application refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the file processing device 100 can be used to implement the following Figures 3 to 9 The file processing method shown in Fig.10 As shown, the file processing device 100 is applied to a computer device (such as Figure 1 In the computer device shown in FIG. 1 , the file processing device 100 includes:

[0179] The acquisition module 1001 is used to acquire file information of a first file in response to a first operation of a user;

[0180] The acquisition module 1001 is further used to acquire extended attribute information of the first file based on the file information of the first file, wherein the extended attribute information includes file path information of the second file; wherein the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file;

[0181] The processing module 1002 is used to process the second file based on the file path information of the second file.

[0182] In the embodiment of the present application, the first file is a backup file of the second file, and the processing module 1002 is further used to copy the first file, save the copied first file according to the file path information of the second file, so as to restore the second file.

[0183] In an embodiment of the present application, the first file is the file after the second file is moved to a trash folder, and the processing module 1002 is further used to move the first file to a file path corresponding to the file path information of the second file to restore the second file.

[0184] In an embodiment of the present application, the first file is a signature file of the second file, and the processing module 1002 is further used to obtain the second file based on the file path information of the second file; and send the first file and the second file.

[0185] In the embodiment of the present application, the first file is a file generated after the second file runs abnormally, and the processing module 1002 is further used to display the second file based on the file path information of the second file.

[0186] In the embodiment of the present application, the second file is an executable file of the first file, and the processing module 1002 is further used to execute the second file based on the file path information of the second file, so that the second file runs the first file.

[0187] In the embodiment of the present application, the processing module 1002 is further used to obtain the file path information of the second file in response to the user's second operation; and store the file path information of the second file in the storage area corresponding to the file extension attribute block of the first file.

[0188] In an embodiment of the present application, the processing module 1002 is also used to determine the index node corresponding to the first file based on the file information of the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block; and obtain the extended attribute information of the first file from the data block based on the pointer.

[0189] In one possible implementation, the acquisition module 1001 is used to obtain file information of the first file and file path information of the second file in response to a second operation of the user, wherein the file information of the first file corresponds to a storage area of ​​a file extension attribute of the first file; the processing module 1002 is used to store the file path information of the second file in a storage area of ​​a file extension attribute of the first file; wherein the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file.

[0190] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the methods in the above-mentioned embodiments of the present application.

[0191] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program runs on a processor, the processor executes the file processing method described in the first aspect or any possible implementation of the first aspect.

[0192] The computer-readable storage medium may be an internal memory of the computer device described in the above embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device.

[0193] In some embodiments, the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the computer device, etc.

[0194] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0195] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0196] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0198] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A file processing method, characterized in that: include: In response to a first operation of a user, obtaining file information of a first file; Based on the file information of the first file, acquiring extended attribute information of the first file, the extended attribute information including file path information of the second file; The relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file; The second file is processed based on the file path information of the second file.

2. The file processing method according to claim 1, characterized in that: The first file is a backup file of the second file, and processing the second file based on the file path information of the second file includes: The first file is copied, and the copied first file is saved according to the file path information of the second file to restore the second file.

3. The file processing method according to claim 1, characterized in that: The first file is a file after the second file is moved to a trash folder, and the processing of the second file based on the file path information of the second file includes: The first file is moved to a file path corresponding to the file path information of the second file to restore the second file.

4. The file processing method according to claim 1, characterized in that: The first file is a signature file of the second file, and processing the second file based on the file path information of the second file includes: Acquire the second file based on the file path information of the second file; The first file and the second file are sent.

5. The file processing method according to claim 1, characterized in that: The first file is a file generated after the second file runs abnormally, and processing the second file based on the file path information of the second file includes: Based on the file path information of the second file, the second file is displayed.

6. The file processing method according to claim 1, characterized in that: The second file is an executable file of the first file, and processing the second file based on the file path information of the second file includes: Based on the file path information of the second file, the second file is executed so that the second file runs the first file.

7. The file processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: In response to a second operation of the user, obtaining file path information of the second file; The file path information of the second file is stored in a storage area corresponding to the file extension attribute block of the first file.

8. The file processing method according to any one of claims 1 to 7, characterized in that: The acquiring, based on the file information of the first file, extended attribute information of the first file includes: Determine, according to the file information of the first file, an index node corresponding to the first file, wherein the index node includes an extended attribute block, and the extended attribute block records a pointer to a data block; The extended attribute information of the first file is obtained from the data block according to the pointer.

9. The file processing method according to any one of claims 1 to 8, characterized in that: The first operation includes inputting a first instruction, the first instruction includes file information of the first file, or the first operation is a click operation on the first file.

10. A file processing method, characterized in that: The method comprises: In response to a second operation of the user, acquiring file information of the first file and file path information of the second file, wherein the file information of the first file corresponds to a storage area of ​​a file extension attribute of the first file; storing the file path information of the second file in a storage area of ​​the file extension attribute of the first file; Among them, the relationship between the first file and the second file includes at least one of the following relationships: the first file is a backup file of the second file, the second file is a source file of the first file, the first file is a signature file of the second file, the first file is a file generated after the second file runs abnormally, or the second file is an executable file of the first file.

11. A computer device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the file processing method according to any one of claims 1 to 10 when executing the computer program.

Citation Information

Cited By

  • File processing method and computer device

    WO2026098000A1