CN113220635B - File archiving method, device, equipment and computer readable storage medium - Google Patents

File archiving method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN113220635B
CN113220635B CN202110514135.XA CN202110514135A CN113220635B CN 113220635 B CN113220635 B CN 113220635B CN 202110514135 A CN202110514135 A CN 202110514135A CN 113220635 B CN113220635 B CN 113220635B
Authority
CN
China
Prior art keywords
file
data
filing
archive
content
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110514135.XA
Other languages
Chinese (zh)
Other versions
CN113220635A (en
Inventor
王科达
梁少佐
林建格
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xinghuo Cnc Technology Co ltd
Original Assignee
Shenzhen Xinghuo Cnc Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xinghuo Cnc Technology Co ltd filed Critical Shenzhen Xinghuo Cnc Technology Co ltd
Priority to CN202110514135.XA priority Critical patent/CN113220635B/en
Publication of CN113220635A publication Critical patent/CN113220635A/en
Application granted granted Critical
Publication of CN113220635B publication Critical patent/CN113220635B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/113Details of archiving
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

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

Abstract

The invention discloses a file archiving method, a device, equipment and a computer readable storage medium, wherein the method comprises the following steps: converting the obtained filing file list and adding the converted filing file list into a container of the current folder data, converting the content into cache data according to the file path and the file content size, compressing the cache data to the current writing position, calculating an MD5 value of a filing head structure, synchronizing the cache data to the filing file and comparing the cache data with the MD5 value of the whole filing file, decompressing the content cache data, obtaining a data set, loading the data set to other data except the content cache data in the filing file, generating a filing container tree, outputting the data in the memory to a file system, and finishing file filing according to the file system. The invention carries out quick check and unpacking on the firmware filing file in the equipment controller, releases the resource file and data to upgrade the equipment, checks and loads the log filing file in daily operation, and carries out dynamic filing storage or addition, deletion, modification and check on the processed data record.

Description

File archiving method, device, equipment and computer readable storage medium
Technical Field
The invention relates to the technical field of intelligent sewing equipment control, in particular to a file archiving method, a file archiving device, equipment and a computer readable storage medium.
Background
In recent years, with the rapid development of industry, artificial intelligence technology is also introduced into industrially manufactured equipment, and in daily operation of sewing equipment, with the increasing demand of manufacturing industry and the strict requirements on products, the scarcity of labor resources and the high cost of manual use result in that the manually operated sewing equipment is not in good order, and the traditional sewing equipment cannot meet the current market demand.
The file filing technology of the sewing equipment controller in the current market can not simultaneously merge one or more files, has high requirements on the configuration of hardware of operating equipment, has a complex operation process and a plurality of dependent interface libraries, needs the support of an operating system, mostly does not support the mixed filing of various types of data and files and the verification of contents, and obviously can not realize the increasing and deleting investigation of the contents and the backup filing and exporting of the data or resource files in the operation process.
Disclosure of Invention
The invention mainly aims to provide a file filing method, a file filing device, equipment and a computer readable storage medium, aiming at improving the intelligence of sewing equipment, reducing the manual operation cost and realizing the intelligent filing of a sewing equipment controller.
In order to achieve the above object, the present invention provides a file filing method, including the steps of:
acquiring an archived file;
converting the archive file and adding the archive file into a container of current folder data, converting file content into cache data according to a file path and content size, compressing the cache data and adding the cache data to a current writing position in a archive header container, and calculating an MD5 value of an archive header structure;
when the filing head structure is consistent with the MD5 value of the filing file, decompressing content cache data to obtain a data set;
loading other data except the content cache data in the archived file through the data set to construct an archived container tree;
and outputting the data of the filing container tree to a file system to finish file filing.
Preferably, the acquiring the archive file further comprises:
and classifying the archived files according to the sequence from big to small to obtain an archived file data sequence.
Preferably, the converting and appending the archive file into a container of current folder data, converting the file content into cache data according to the file path and the file content size, compressing the cache data and appending the cache data to the current writing position in the archive header container, and calculating the MD5 value of the archive header structure includes:
converting the filing file list into a file data and folder data structure, wherein the file data or the folder data are contained in a container of the folder data, and the containing number of the folders is increased progressively;
according to the file data and the folder data structure, synchronizing the structure in the container to the archived file, and judging whether the file type in the container is file data or not;
if the file type is file data, compressing the file data and writing the file data into an archived file, loading file contents according to the size of a file path, dynamically converting the contents into content cache data to compress the content cache data, and adding the content cache data to the current writing position of the archive;
and calculating the MD5 value of the file head structure according to the writing position, and synchronizing the MD5 value to the file.
Preferably, the calculating the MD5 value of the archive header structure according to the current writing position includes:
inputting variable length information into an MD5 model based on the current writing position of the archive file to obtain an archive head structure MD5 value.
Preferably, when the archive header structure is consistent with the MD5 value of the entire archive file, decompressing the content cache data to obtain the data set includes:
judging whether the fixed magic number in the filing head is correct or not based on the content value in the filing file and the content except the length in the filing head structure;
if the fixed magic number is correct, calculating MD5 values of all the archived files and comparing the MD5 values with the MD5 values of the loaded archived head structure to obtain a comparison result;
based on the comparison result, when the MD5 values in the compared archive file and the archive head structure are consistent, determining a 64-byte data structure in the archive file according to the structure length in the archive file, and decompressing the 64-byte data structure in the archive file to generate a data set.
Preferably, loading other data in the archive file except the content cache data through the data set, and constructing the archive container tree includes:
extracting the byte length of the current archived file;
combining the byte length and the byte type into a corresponding structure, adding the byte length into a structure table of a container type structure loaded at the last time, and obtaining the filing container tree when the filing file is loaded.
Preferably, said outputting the data traversal of the archive container tree to the file system, and completing and outputting according to the file system type includes:
sequentially accessing each node of the archive container tree, and outputting the content cache data to the file system;
judging whether the content cache data in the file system is folder data or not;
and if the file is folder data, extracting content cache data which is next to the file in the filing file according to the length index in the folder data, and decompressing and outputting the folder data to the file.
In addition, to achieve the above object, the present invention also provides a file filing apparatus comprising:
the acquisition module is used for acquiring the archived file;
the analysis module is used for converting the archive file and adding the archive file into a device of the current folder data, converting the content of the file into cache data according to the file path and the content size, compressing the cache data and adding the cache data to the current writing position in the archive header container, and calculating the MD5 value of the archive header structure;
the decompression module is used for decompressing content cache data to obtain a data set when the filing head structure is consistent with the MD5 value of the filing file;
the construction module is used for loading other data except the content cache data in the archived file through the data set and constructing an archived container tree;
and the output module is used for outputting the data of the archive container tree to a file system.
Preferably, the analysis module is further configured to:
converting the archived file into a file data and folder data structure;
synchronizing the file data in the container of the current folder data and the current folder data into the archived file, and judging the files in the archived file;
if the file type is file data, compressing the file data and writing the file data into the archived file, loading file contents according to the size of a file path, dynamically converting the contents into content cache data, compressing the content cache data, and then adding the content cache data to the current writing position of the archived file;
calculating the MD5 value for the archive file based on the current write location.
Preferably, said calculating MD5 value of the archive file according to said current writing location, synchronizing it to the archive file is further configured to:
inputting variable length information into an MD5 model based on the current writing position of the archived file, and calculating an MD5 value of the archived file through an MD5 model algorithm to obtain an MD5 value.
And sorting according to the size of the MD5 value, and synchronizing the MD5 value to an archive file.
Preferably, the decompression module is further configured to:
judging whether the fixed magic number in the filing head is correct or not based on the content value in the filing file and the content except the length in the filing head structure;
if the matching magic number is correct, calculating MD5 values of all the filing files and comparing the MD5 values with the MD5 values of the loaded filing head structure to obtain a comparison result;
based on the comparison result, when the MD5 values in the comparison file and the archive head structure are consistent, determining a 64-byte data structure in the archive file according to the structure length in the archive file, and decompressing the 64-byte data structure in the archive file to generate a data set.
Preferably, the building module further comprises:
extracting the byte length of the current archived file;
combining the byte length and the byte type into a corresponding structure, adding the byte length into a structure table of a container type structure loaded at the last time, and obtaining the filing container tree when the filing file is loaded.
Preferably, the output module is further configured to:
accessing each node of the archive container tree and outputting the content cache data to the file system;
judging whether the content cache data in the file system is folder data or not;
and if the file is folder data, extracting content cache data which is next to the file in the filing file according to the length index in the folder data, and decompressing and outputting the folder data to the file.
In addition, to achieve the above object, the present invention also provides a file filing apparatus, comprising: a memory, a processor and a file archiving program stored on the memory and executable on the processor, the file archiving program when executed by the processor implementing the steps of the file archiving method as described above.
In addition, to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a file archiving program which, when executed by a processor, implements the steps of the file archiving method as described above.
The file filing method provided by the invention comprises the steps of converting an obtained filing file, adding the converted filing file into a container of current folder data, compressing the file data, converting content into cache data according to a file path and the size of file content, filing the cache data to a current writing position in a filing head container, calculating an MD5 value of a filing head structure, synchronizing the MD5 value to the filing file, decompressing a data structure in the filing file through structure length indexes when the MD5 value of the filing head structure is consistent with the MD5 value in the filing head structure, generating a data set, loading other structures except the content cache data in the filing file through the data set, generating a filing container tree, traversing data in a memory according to the filing container tree, and outputting the data based on the type of a file system. When the sewing equipment runs, the equipment supports the mixed filing of various types of data and files and the verification of contents, and can apply classification technology in embedded products to realize the backup filing and exporting of data or resource files of a sewing equipment controller.
Drawings
FIG. 1 is a schematic diagram of an apparatus architecture of a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an embodiment of a file archiving method according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The device of the embodiment of the invention can be a PC or a server device.
As shown in fig. 1, the apparatus may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting of the apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a file archiving program.
The operating system is a program for managing and controlling the file archiving equipment and software resources, and supports the operation of a network communication module, a user interface module, a file archiving program and other programs or software; the network communication module is used for managing and controlling the network interface 1002; the user interface module is used to manage and control the user interface 1003.
In the file archiving apparatus shown in fig. 1, the file archiving apparatus calls a file archiving program stored in the memory 1005 by the processor 1001 and performs the operations in the respective embodiments of the file archiving method described below.
Based on the hardware structure, the embodiment of the file archiving method is provided.
Referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of a file archiving method according to the present invention, where the method includes:
step S10, acquiring an archive file;
step S20, converting the filing file and adding the file into the container of the current folder data, converting the file content into cache data according to the file path and the file content size, compressing the cache data and adding the cache data to the current writing position in the filing header container, and calculating the MD5 value of the filing header structure;
step S30, when the filing header structure is consistent with the MD5 value of the filing file, decompressing the content cache data to obtain a data set;
step S40, loading other data except the content cache data in the archive file through the data set to construct an archive container tree;
step S50, the data of the archive container tree is output to the file system, and the file archiving is completed.
The file filing method is applied to the file filing equipment manufactured in industry, the file filing equipment can be a terminal, a robot or PC equipment, and for convenience in description, the file filing equipment is described by taking a sewing equipment controller as an example. When the sewing device controller runs, the archival files in the sewing device controller need to be operated so as to be convenient for controlling the sewing device through the controller, when the control instruction of the sewing device by the controller needs to be changed, the control instruction of the sewing device needs to be input from the outside to change data parameters in the controller, the firmware archival files in the sewing device controller are quickly checked and unpacked, the resource files and the data are released to upgrade the device, when the log archival files are checked and loaded, dynamic archival storage or incremental deletion and modification are carried out on processed data records, backup and export of the data or the resource files of the sewing device controller, and the like. In the process, if the judgment of the sewing device controller on the magic number is wrong, and the description file is damaged when the MD5 value in the file head structure is inconsistent with the current MD5 value, the construction is finished. For convenience of description, the following description will be given taking a controller of a sewing machine as an example.
Further, starting the sewing equipment, converting the obtained filing file list and adding the converted filing file list into a container of the current folder data, compressing the file data, converting the file data content into cache data according to the file path and the file content size, compressing the cache data to the current writing position, calculating an MD5 value of the filing file, synchronizing the MD5 value of the filing file and the MD5 value of the loading filing head, comparing the MD and the cache data with each other, when the check values between the MD and the cache data are consistent, decompressing the structure length to determine a content cache data structure in the filing file, obtaining a data set, loading the data set into other structures except the content cache data in the filing file, generating a filing container tree, traversing and outputting the data in the memory to a file system, finishing and outputting according to the file system, and realizing the filing of the intelligent sewing equipment controller file.
The respective steps will be described in detail below:
step S10, acquiring an archive file;
in this embodiment, after the sewing device is started, the control instruction input by the user before is still retained in the sewing device controller at this time, the sewing device can automatically reply the instruction executed last time, and if the instruction is not changed, the starting program is started only by pressing the starting key, and the sewing device is operated and works normally. If the new equipment is started for the first time or the sewing equipment needing to be added with a new command is adopted, a control command needing to be executed by the sewing equipment is input, wherein the command comprises various types of data structures and respectively comprises the following steps: when the 64-byte data, the file data, the content cache data, the folder data and the filing head are read, the reading position can be automatically shifted according to the length of the read content when the content of the input instruction is read, and the shift length and the length of the read content are always consistent.
Furthermore, the method comprises the steps of extracting the archived files, initializing the archived files of the instruction file archive heads, classifying and packaging the input instruction files, dividing different instruction files into different file data packets, enabling the sewing device controller to quickly inquire the instruction files when the sewing device is started, enabling a user to quickly search and quickly delete the wrong instruction files when the input instructions are wrong, and realizing quick inquiry and modification of the newly added content of the instruction files of the sewing device controller.
Step S20, converting the list of the archive files and adding the converted list to the container of the current folder data, converting the file content into cache data according to the file path and the file content size, compressing the cache data and adding the cache data to the current writing position in the archive header container, and calculating the MD5 value of the archive header structure.
In this embodiment, after acquiring the archive file, the sewing device controller classifies the archive files in descending order to obtain an archive file data sequence, thereby obtaining an archive file list, and converts the list of archive files into file data and a folder data structure by a conversion unit included under the analysis module, wherein the file data includes an instruction code file input to the sewing device controller, and the folder data structure is a data element set with structural features for organizing instruction data and documents in the file, and the structure is calculated by the logical structural relationship of data between them. When the conversion is successful, it is necessary to add file data or a folder data structure to the archive container of the archive header.
Furthermore, the analysis module further comprises an identification unit and a judgment unit, after the file data or the folder data structure is added into the filing container, whether the file content exists in the filing container is identified through the identification unit, when the file content exists in the filing container is determined, whether the file type existing in the filing container is the file data or the folder data structure is judged through the judgment unit, when the file type in the filing container is the file data, the file data needs to be compressed and written into the filing file, wherein the compression and decompression adopt an LZ4 open source algorithm, the compact and efficient compression and decompression effect is achieved, and the embedded type file is very suitable for embedded products. And then after determining according to the path of the file, setting the loading speed of one cache block every 4k to load the content of the file, then dynamically converting the content into content cache data at the speed of one cache block every 4k, compressing and appending the converted content cache data to the current writing position, and carrying out the same processing process on each piece of content until all the content of the file is completely loaded. Inputting variable-point length information according to MD5, outputting a fixed-length 128-bits algorithm, generating four 32-bit data, and combining the four 32-bit data into a 128-bits hash, wherein the basic mode comprises the following steps: and (4) performing cyclic operation on the remainder, the adjustment length and the link variable to finally obtain a result.
In this embodiment, the sewing machine controller determines the file type in the archive container and compresses, sets the path, and sets the loading speed by converting the archive file list and adding it to the archive container, and then calculates the MD5 value of the archive file and synchronizes it to the archive file. The filing file list is converted, error reporting of input instructions is reduced, and loading speed and running speed of the sewing device controller to the instructions are improved.
Step S30, when the archive header structure is consistent with the MD5 value of the archive file, decompressing the content cache data to obtain a data set.
In this embodiment, first, 2 bytes length content is read from the beginning of the file of the sewing machine controller, the read content value is recorded as L0, then the content value L0 bytes length content is further read from the current reading position and recorded as R0, the byte length R0 is the content except the length of the filing header, the two are combined into a filing header structure based on the content value L0 and the byte length R0, and whether the fixed magic number in the filing header file is correct is judged, wherein the magic number refers to a digital constant or a character string which appears in the code but is not interpreted, whether the MD5 value in the filing header structure is consistent with the MD5 value of the file is judged, if not, the file is damaged, and if so, the construction is finished, if so, a 64-byte data structure in the filing file needs to be indexed according to the structure length in the filing file, and further decompressing the data to obtain a data set.
In this embodiment, the byte length and the content value are read and combined to form a file header structure, and the MD5 value of the current file and the MD5 value of the file header file are compared and decompressed. Reading the byte length and the content value is beneficial to comprehensively capturing all information of the user instruction by the sewing equipment, and the accuracy of instruction reading can be improved by comparing the MD5 values before and after the reading, so that the working efficiency of the user when using the sewing equipment can be greatly improved.
Step S40, load the other data in the archive file except the content cache data through the data set, and construct an archive container tree.
In this embodiment, after completing the above steps, the controller of the sewing machine reads the 2-byte length content again at the current reading position, records the content value as L1, then reads the L1-byte length content again at the current reading position, and records it as R1, where the first 2-byte type of the byte length content R1 is T1, the rest distinguishes a specific data structure according to the type value of T1, and both the content value L1 and the byte length content R1 form a structure S1 corresponding to the type value of T1, where the T1 value may be a header, 64-byte data, file data, content cache data, or folder data structure, etc. Adding a corresponding structure S1 to the structure table of the last loaded container type structure, wherein the container comprises: archives and folder structures. By the reading method, the content value and the byte length content of each stage are repeatedly read, the content value and the byte length content read in each stage are combined, the type value obtained by combining each stage is recorded until the end of the file is read from the header file of the file, and the complete filing container tree is obtained through the construction.
Further, the sewing device controller loads all other structures except the content cache data in the archive file by reading the byte length, and generates a complete archive container tree. Extracting the characteristic value of information gain maximally according to the constructed tree model until the end condition or the accuracy of the child node reaches a certain threshold, testing the characteristic attribute represented by each child node of the container tree, wherein each score represents the output of the characteristic attribute on a certain value range, and one child node stores one category which is used as a decision result.
In the embodiment, the files in the sewing equipment controller are classified and managed through the constructed filing container tree, so that the speed of inquiring the files by the equipment controller is greatly increased when the equipment controller obtains an instruction, the execution speed of the equipment on the instruction is increased, and the competitiveness of the sewing equipment in a fierce market environment is improved.
Step S50, the data of the archive container tree is output to the file system, and the file archiving is completed.
In this embodiment, each node of the constructed filing container tree is traversed and output to a file system, and the file type in the filing container tree is further determined, and if the file type in the filing container tree is a non-file data and folder data structure, only information is printed at this time; if the file type is a folder data structure, dynamically establishing a file directory according to file data; if the file data is the file data, the content cache structure next following in the archive file is indexed out according to the length in the structure, and the file data is sent to the file through decompression until the next non-content cache structure follows.
In this embodiment, when the non-content caching is finished, it indicates that the traversal of each node of the archive container tree is finished, and releases all resources in the sewing device controller, thereby completing the update of the archive file. The controller file of the sewing equipment is filed, so that the intelligent sewing equipment can be realized, the labor cost is reduced, the product quality can be guaranteed, the competitiveness of the sewing equipment in the industry is improved, and the excellent experience is brought to a user.
The invention also provides a file filing device. The file filing apparatus of the present invention comprises:
the acquisition module is used for acquiring the archived file;
the analysis module is used for converting the archive file and adding the archive file into a container of current folder data, converting file content into cache data according to a file path and content size, compressing the cache data and adding the cache data to a current writing position in a archive header container, and calculating an MD5 value of an archive header structure;
the decompression module is used for decompressing content cache data to obtain a data set when the filing head structure is consistent with the MD5 value of the filing file;
the construction module is used for loading other data except the content cache data in the archived file through the data set and constructing an archived container tree;
and the output module is used for outputting the data of the filing container tree to a file system to finish file filing.
Further, the analysis module is further configured to:
converting the archived file into a file data and folder data structure;
synchronizing the file data in the container of the current folder data and the current folder data into the archived file, and judging the file type in the archive;
if the file type is file data, compressing the file data and writing the file data into the archived file, loading file contents according to the size of a file path, then dynamically converting the contents into content cache data, compressing the content cache data, and then adding the content cache data to the current writing position of the archived file;
and calculating the MD5 value of the filing head structure according to the current writing position.
Further, the analysis module is further configured to:
inputting variable length information into an MD5 model based on the current writing position of the archived file, and calculating an MD5 value of the archived file through an MD5 model algorithm to obtain an MD5 value of the archived head structure.
And sorting according to the size of the MD5 value, and synchronizing the MD5 value to an archive file.
Further, the decompression module is further configured to:
judging whether the fixed magic number in the filing head is correct or not based on the content value in the filing file and the content except the length in the filing head structure;
if the fixed magic number is correct, calculating MD5 values of all the archived files and comparing the MD5 values with the MD5 values of the loaded archived head structure to obtain a comparison result;
based on the comparison result, when the MD5 values in the compared archive file and the archive head structure are consistent, determining a 64-byte data structure in the archive file according to the structure length in the archive file, and decompressing the 64-byte data structure in the archive file to generate a data set.
Further, the building module further comprises:
extracting the byte length of the current archived file;
combining the byte length and the byte type into a corresponding structure, adding the byte length into a structure table of a container type structure loaded at the last time, and obtaining the filing container tree when the filing file is loaded.
Further, the output module is further configured to:
sequentially accessing each node of the archive container tree, and outputting the content cache data to the file system;
judging whether the content cache data in the file system is folder data or not;
and if the file is folder data, extracting content cache data which is next to the file in the filing file according to the length index in the folder data, and decompressing and outputting the folder data to the file.
The invention also provides a computer readable storage medium.
The computer-readable storage medium of the present invention has stored thereon a file archiving program which, when executed by a processor, implements the steps of the file archiving method described above.
The method implemented when the file archiving program running on the processor is executed may refer to each embodiment of the file archiving method of the present invention, and details are not described here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A file archiving method, characterized in that the file archiving method comprises:
acquiring an archived file, wherein the archived file is an instruction file;
converting the archived file into file data and a folder data structure, wherein the file data comprises an instruction code file, and the folder data structure is used for attributing a data element set with structural characteristics in the file;
judging the file type in the archived file;
if the file type is file data, compressing the file data and writing the file data into the archived file, loading file contents according to the size of a file path, then dynamically converting the contents into content cache data, compressing the content cache data, and then adding the content cache data to the current writing position of the archived file;
calculating an MD5 value of an archive head structure according to the current writing position, wherein the byte length and the content value in the archive file are read and combined to form the archive head structure;
when the filing head structure is consistent with the MD5 value of the filing file, decompressing content cache data to obtain a data set;
loading content cache data and other data except the content cache data in an archive file through the data set to construct an archive container tree, wherein the construction process of the archive container tree comprises the following steps: repeatedly reading the content value and the byte length content of each stage, combining the content value and the byte length content read in each stage, and recording the type value obtained by combining each stage until the end of reading the file from the header file of the archived file;
and outputting the data of the filing container tree to a file system to finish file filing.
2. The file archiving method according to claim 1, wherein said obtaining the archived file further comprises:
and classifying the archived files according to the sequence from big to small to obtain an archived file list.
3. The file archiving method according to claim 1, wherein said calculating the MD5 value of the archive header structure according to the current write location comprises:
inputting variable length information into an MD5 model based on the current writing position of the archive file, and obtaining an MD5 value of the archive head structure.
4. The file archiving method according to claim 1, wherein said decompressing the content cache data into the data set when the archive header structure is consistent with the MD5 value of the archive file comprises:
judging whether the fixed magic number in the filing head is correct or not based on the content value in the filing file and the content except the length in the filing head structure;
if the fixed magic number is correct, calculating MD5 values of all the archived files and comparing the MD5 values with the MD5 values of the loaded archived head structure to obtain a comparison result;
based on the comparison result, when the MD5 values in the compared archive file and the archive head structure are consistent, determining a 64-byte data structure in the archive file according to the structure length in the archive file, and decompressing the 64-byte data structure in the archive file to generate a data set.
5. The file archiving method according to claim 1, wherein the loading of the content cache data and other data except the content cache data in the archived file through the data set to construct the archive container tree comprises:
extracting the byte length of the current archived file;
combining the byte length and the byte type into a corresponding structure, adding the byte length into a structure table of a container type structure loaded at the last time, and obtaining the filing container tree when the filing file is loaded.
6. The file archiving method according to claim 1, wherein outputting data of the archive container tree to a file system, completing the file archiving comprises:
sequentially accessing each node of the archive container tree, and outputting the content cache data to the file system;
judging whether the content cache data in the file system is a file data structure;
and if the file data structure is a file data structure, the content cache data which is next to the archived file is retrieved according to the length in the file data structure, and the file data is decompressed and output to the file.
7. A file filing apparatus, characterized in that the file filing apparatus comprises:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an archived file, and the archived file is an instruction file;
the analysis module is used for converting the archived file into file data and a folder data structure, wherein the file data comprises an instruction code file, and the folder data structure is a data element set with structural characteristics in a file; judging the file type in the archived file; if the file type is file data, compressing the file data and writing the file data into the archived file, loading file contents according to the size of a file path, then dynamically converting the contents into content cache data, compressing the content cache data, and then adding the content cache data to the current writing position of the archived file; calculating an MD5 value of an archive head structure according to the current writing position, wherein the byte length and the content value in the archive file are read and combined to form the archive head structure;
the decompression module is used for decompressing a cache data structure to obtain a cache data set when the archive head structure is consistent with the MD5 value of the archive file;
a building module, configured to load, through the data set, content cache data and other data except the content cache data in an archive file, and build an archive container tree, where a building process of the archive container tree includes: repeatedly reading the content value and the byte length content of each stage, combining the content value and the byte length content read in each stage, and recording the type value obtained by combining each stage until the end of reading the file from the header file of the archived file;
and the output module is used for outputting the data of the filing container tree to a file system to finish file filing.
8. A file filing apparatus, characterized in that the file filing apparatus comprises: memory, a processor and a file archiving program stored on the memory and executable on the processor, the file archiving program when executed by the processor implementing the steps of the file archiving method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a file archiving program which, when executed by a processor, implements the steps of the file archiving method according to any one of claims 1 to 6.
CN202110514135.XA 2021-05-11 2021-05-11 File archiving method, device, equipment and computer readable storage medium Active CN113220635B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110514135.XA CN113220635B (en) 2021-05-11 2021-05-11 File archiving method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110514135.XA CN113220635B (en) 2021-05-11 2021-05-11 File archiving method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113220635A CN113220635A (en) 2021-08-06
CN113220635B true CN113220635B (en) 2022-02-15

Family

ID=77094915

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110514135.XA Active CN113220635B (en) 2021-05-11 2021-05-11 File archiving method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113220635B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1797451A (en) * 2004-12-28 2006-07-05 台湾积体电路制造股份有限公司 Data archiving management systems and methods
EP3098726A1 (en) * 2014-01-24 2016-11-30 Zakrytoe Aktsionernoe Obschestvo "RIVV" Method for extracting useful content from setup files of mobile applications
CN108874639A (en) * 2018-03-27 2018-11-23 平安科技(深圳)有限公司 Log archiving method, electronic device and readable storage medium storing program for executing
CN109710614A (en) * 2018-12-28 2019-05-03 深圳市同行者科技有限公司 A kind of method and device of real-time data memory and inquiry
CN110716895A (en) * 2019-09-17 2020-01-21 平安科技(深圳)有限公司 Target data archiving method and device, computer equipment and medium
CN112527733A (en) * 2020-11-04 2021-03-19 郑州信大捷安信息技术股份有限公司 Method and system for processing messy codes of archived file and compressed file in linux system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8275750B2 (en) * 2006-11-08 2012-09-25 International Business Machines Corporation Method to efficiently use the disk space while unarchiving
CN101676899A (en) * 2008-09-18 2010-03-24 上海宝信软件股份有限公司 Profiling and inquiring method for massive database records
CN111611211A (en) * 2020-04-27 2020-09-01 深圳壹账通智能科技有限公司 File importing and archiving method, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1797451A (en) * 2004-12-28 2006-07-05 台湾积体电路制造股份有限公司 Data archiving management systems and methods
EP3098726A1 (en) * 2014-01-24 2016-11-30 Zakrytoe Aktsionernoe Obschestvo "RIVV" Method for extracting useful content from setup files of mobile applications
CN108874639A (en) * 2018-03-27 2018-11-23 平安科技(深圳)有限公司 Log archiving method, electronic device and readable storage medium storing program for executing
CN109710614A (en) * 2018-12-28 2019-05-03 深圳市同行者科技有限公司 A kind of method and device of real-time data memory and inquiry
CN110716895A (en) * 2019-09-17 2020-01-21 平安科技(深圳)有限公司 Target data archiving method and device, computer equipment and medium
CN112527733A (en) * 2020-11-04 2021-03-19 郑州信大捷安信息技术股份有限公司 Method and system for processing messy codes of archived file and compressed file in linux system

Also Published As

Publication number Publication date
CN113220635A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
US7664783B2 (en) File management program, data structure, and file management device
US20130067237A1 (en) Providing random access to archives with block maps
US8572054B2 (en) Forward compatibility guaranteed data compression and decompression method and apparatus thereof
CN108108394B (en) Compressed file recovery method and storage medium of APFS file system
WO2021051532A1 (en) Data compression method, apparatus and device, and computer-readable storage medium
US9577666B2 (en) Method and system
EP1519279A2 (en) Document transformation system
CN111813378A (en) Code base construction system, method and related device
CN113220635B (en) File archiving method, device, equipment and computer readable storage medium
CN106033335A (en) An installation package generating method and device
US20200272784A1 (en) A method and system for compressing data
CN105811994A (en) Computer data zipping and processing system
CN108829872B (en) Method, device, system and storage medium for rapidly processing lossless compressed file
CN111970161B (en) Internet of things application differential upgrading method based on address prediction
US20170033803A1 (en) Compression method and decompression method
CN110222105B (en) Data summarization processing method and device
US10684831B2 (en) Information processing apparatus, information processing method, and recording medium
CN111552670A (en) Method and system for expanding and supporting compressed file and decompressed file
CN113760757B (en) Method and system for generating test model based on HAR file
US9852143B2 (en) Enabling random access within objects in zip archives
CN113821757B (en) CMS-based rapid station building method and system
CN112579546B (en) File compression method, system, storage medium and terminal
CN113822022A (en) PPT (Power Point) auditing processing method, device, equipment and storage medium
CN117251451A (en) Configuration data acquisition method, device, electronic equipment and storage medium
JP2001159991A (en) Device and method for managing file and recording medium for recording file managing program

Legal Events

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