CN115129669A - File processing method and device, storage medium and electronic equipment - Google Patents

File processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115129669A
CN115129669A CN202210798969.2A CN202210798969A CN115129669A CN 115129669 A CN115129669 A CN 115129669A CN 202210798969 A CN202210798969 A CN 202210798969A CN 115129669 A CN115129669 A CN 115129669A
Authority
CN
China
Prior art keywords
file
checked
standard
check value
condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210798969.2A
Other languages
Chinese (zh)
Inventor
夏松
郭玉章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202210798969.2A priority Critical patent/CN115129669A/en
Publication of CN115129669A publication Critical patent/CN115129669A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations

Landscapes

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

Abstract

本发明提供了一种文件处理方法及装置、存储介质及电子设备,该方法包括:响应于校验指令,获取待处理分布式程序的文件目录信息;在文件目录信息与待处理分布式程序对应的标准文件目录信息一致的情况下,确定文件目录信息下的待核验文件;若待核验文件的修改时间与所述待核验文件对应的标准修改时间不一致、待核验文件为文本类型文件且待核验文件的校验值与标准校验值不一致的情况下,将所述待核验文件与所述待核验文件对应的标准文件进行比对;在所述待核验文件与所述标准文件比对不通过的情况下,利用所述标准文件替换所述待核验文件。应用本发明提供的方法,能够快速准确地处理发生不一致异常的文件。

Figure 202210798969

The present invention provides a file processing method and device, a storage medium and an electronic device. The method includes: in response to a verification instruction, acquiring file directory information of a distributed program to be processed; If the standard file directory information is consistent, determine the file to be verified under the file directory information; if the modification time of the to-be-verified file is inconsistent with the standard modification time corresponding to the to-be-verified file, the to-be-verified file is a text type file and is to be verified When the check value of the file is inconsistent with the standard check value, compare the document to be checked with the standard document corresponding to the document to be checked; if the comparison of the document to be checked and the standard file fails In the case of , use the standard file to replace the to-be-verified file. By applying the method provided by the present invention, files with inconsistent exceptions can be processed quickly and accurately.

Figure 202210798969

Description

File processing method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a file processing method and apparatus, a storage medium, and an electronic device.
Background
With the rapid development of computer science, distributed technology is also widely applied, the consistency and reliability of data are basic requirements of distributed storage, but due to the restriction of hardware such as a disk and a network, fault scenes are frequent, so that the deployment of distributed programs faces the problem of program file consistency.
At present, in order to avoid the problem of inconsistency of distributed program files, an information digest algorithm is usually used for comparing the consistency of files, however, the information digest algorithm has a series of problems such as hash collision and the like, which can cause different data files to generate the same hash, and further cause that the files with the inconsistency and the abnormality cannot be processed in time, and thus, the operation and maintenance risk is easily caused.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a file processing method, which can quickly and accurately process files with inconsistent and abnormal processing.
The invention also provides a file processing device which is used for ensuring the realization and the application of the method in practice.
A method of file processing, comprising:
responding to the checking instruction, and acquiring file directory information of the distributed program to be processed;
determining a file to be verified under the file directory information under the condition that the file directory information is consistent with standard file directory information corresponding to the distributed program to be processed;
judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked;
under the condition that the modification time of the file to be verified is inconsistent with the standard modification time, judging whether the file to be verified is a text type file or not;
under the condition that the file to be checked is a text type file, judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked;
comparing the file to be checked with a standard file corresponding to the file to be checked under the condition that the check value of the file to be checked is inconsistent with the standard check value;
and under the condition that the comparison between the file to be checked and the standard file does not pass, replacing the file to be checked with the standard file.
Optionally, the determining whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked includes:
under the condition that the file to be checked meets a preset fragmentation condition, segmenting the file to be checked to obtain each fragment; calculating a fragment check value of each fragment, and judging whether the fragment check value of each fragment is consistent with a pre-recorded standard fragment check value corresponding to the fragment;
and under the condition that the file to be checked does not meet the preset fragmentation condition, calculating the file check value of the file to be checked, and judging whether the file check value of the file to be checked is consistent with the pre-recorded standard file check value corresponding to the file to be checked.
Optionally, the comparing the file to be checked with the standard file corresponding to the file to be checked includes:
respectively preprocessing the file to be checked and the standard file to remove invalid information in the file to be checked and the standard file;
calculating the matching degree between the preprocessed file to be checked and the preprocessed standard file;
under the condition that the matching degree meets a preset matching degree threshold value, determining that the file to be verified passes the comparison with the standard file;
and under the condition that the matching degree does not meet a preset matching degree threshold value, determining that the comparison between the file to be checked and the standard file does not pass.
The method described above, optionally, further includes:
and under the condition that the file to be checked is not a text type file, if the check value of the file to be checked is inconsistent with the standard check value corresponding to the file to be checked, replacing the file to be checked with the standard file corresponding to the file to be checked.
The method described above, optionally, further includes:
and under the condition that the file directory information is inconsistent with standard file directory information corresponding to the distributed program to be processed, determining that the file directory information is abnormal, and outputting a part inconsistent with the standard file target information in the file directory information.
A document processing apparatus comprising:
the acquisition unit is used for responding to the verification instruction and acquiring file directory information of the distributed program to be processed;
the determining unit is used for determining the file to be verified under the file directory information under the condition that the file directory information is consistent with the standard file directory information corresponding to the distributed program to be processed;
the first judgment unit is used for judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked;
the second judging unit is used for judging whether the file to be checked is a text type file or not under the condition that the modification time of the file to be checked is inconsistent with the standard modification time;
the third judging unit is used for judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked or not under the condition that the file to be checked is a text type file;
the comparison unit is used for comparing the file to be checked with the standard file corresponding to the file to be checked under the condition that the check value of the file to be checked is inconsistent with the standard check value;
and the replacing unit is used for replacing the file to be checked by using the standard file under the condition that the comparison between the file to be checked and the standard file fails.
Optionally, the apparatus described above, wherein the third determining unit includes:
the first execution subunit is used for segmenting the file to be verified under the condition that the file to be verified meets a preset segmentation condition to obtain each segment; calculating the fragment check value of each fragment, and judging whether the fragment check value of each fragment is consistent with a pre-recorded standard fragment check value corresponding to the fragment;
and the second execution subunit is used for calculating the file check value of the file to be checked under the condition that the file to be checked does not meet the preset fragmentation condition, and judging whether the file check value of the file to be checked is consistent with the pre-recorded standard file check value corresponding to the file to be checked.
The above apparatus, optionally, the comparing unit includes:
the preprocessing subunit is used for respectively preprocessing the file to be checked and the standard file so as to eliminate invalid information in the file to be checked and the standard file;
the calculation subunit is used for calculating the matching degree between the preprocessed file to be checked and the preprocessed standard file;
the first determining subunit is configured to determine that the file to be verified passes the comparison between the standard file and the file to be verified when the matching degree meets a preset matching degree threshold;
and the second determining subunit is used for determining that the comparison between the file to be verified and the standard file does not pass under the condition that the matching degree does not meet a preset matching degree threshold value.
A storage medium comprising stored instructions, wherein when executed, the instructions control a device on which the storage medium is located to perform a file processing method as described above.
An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by the one or more processors to perform the file processing method as described above.
Compared with the prior art, the invention has the following advantages:
the invention provides a file processing method and device, a storage medium and electronic equipment, wherein the method comprises the following steps: responding to the checking instruction, and acquiring file directory information of the distributed program to be processed; determining a file to be verified under the file directory information under the condition that the file directory information is consistent with standard file directory information corresponding to the distributed program to be processed; judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked; under the condition that the modification time of the file to be checked is inconsistent with the standard modification time, judging whether the file to be checked is a text type file or not; under the condition that the file to be checked is a text type file, judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked; comparing the file to be checked with a standard file corresponding to the file to be checked under the condition that the check value of the file to be checked is inconsistent with the standard check value; and under the condition that the comparison between the file to be checked and the standard file is not passed, replacing the file to be checked with the standard file. By applying the method provided by the embodiment of the invention, the files with inconsistent and abnormal conditions can be quickly and accurately processed.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart of a method of processing a document according to the present invention;
FIG. 2 is a flowchart illustrating a process of comparing a document to be verified with a standard document according to the present invention;
FIG. 3 is a flow chart of a file processing process provided by the present invention;
FIG. 4 is a flow chart of a process for collecting criteria information provided by the present invention;
FIG. 5 is a flow chart of an initialization information checking process provided by the present invention;
FIG. 6 is a flow chart of a daily information verification process provided by the present invention;
FIG. 7 is a schematic structural diagram of a document processing apparatus according to the present invention;
fig. 8 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
An embodiment of the present invention provides a file processing method, which may be applied to an electronic device, where a method flowchart of the method is shown in fig. 1, and specifically includes:
s101: and responding to the checking instruction, and acquiring the file directory information of the distributed program to be processed.
In this embodiment, the to-be-processed distributed program may be one or more of distributed programs that are deployed in advance.
Optionally, each to-be-processed distributed program has one file directory information.
S102: and under the condition that the file directory information is consistent with the standard file directory information corresponding to the distributed program to be processed, determining the file to be verified under the file directory information.
In this embodiment, the file target directory information may be compared with standard file directory information, where the standard file directory information may be collected in advance, the number of files to be verified under the file directory information is one or more, and the standard file directory information is recorded in a preset configuration file.
S103: judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked; if not, executing S104, if yes, executing S108.
In this embodiment, the modification time may be the last time the file to be verified changes, the standard modification time may be collected in advance, and the standard modification time is recorded in the preset configuration file.
S104: judging whether the file to be checked is a text type file or not; if yes, executing S105; if not, S109 is executed.
In this embodiment, the file to be checked may be one of a text type file and a non-text type file, and whether the file to be checked is a text type file may be determined according to a file suffix or a file content of the file to be checked.
S105: judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked; if not, executing S106, if yes, executing S108.
In this embodiment, the check value of the file to be checked may be calculated, and the algorithm used in calculating the check value to be checked may be, but is not limited to, an information digest algorithm such as MD5(Message-digest algorithm 5).
Optionally, the standard check value corresponding to the file to be checked may be collected in advance; under the condition that the file to be verified is the file of the type, the corresponding standard verification value can be each standard fragment verification value or a standard file verification value, and the standard verification value is recorded in a preset configuration file.
S106: and comparing the file to be checked with the standard file corresponding to the file to be checked under the condition that the check value of the file to be checked is inconsistent with the standard check value.
In this embodiment, the document to be checked and the standard document corresponding to the document to be checked may be compared in a strong text consistency manner.
S107: and under the condition that the comparison between the file to be checked and the standard file does not pass, replacing the file to be checked with the standard file.
In this embodiment, when the comparison between the file to be checked and the standard file fails, the file to be checked may be replaced by the standard file, and specifically, the file to be checked may be covered by the standard file.
S108: and determining that the file to be verified passes the verification.
S109: judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked, if so, executing S108; if not, go to S110.
S110: and replacing the file to be checked by using the standard file corresponding to the file to be checked.
In this embodiment, after the standard file is used to replace the file to be verified, the file modification time of the file to be verified can be updated in the configuration file.
By applying the method provided by the embodiment of the invention, the files with inconsistent and abnormal conditions can be quickly and accurately processed.
In an embodiment of the present invention, based on the foregoing implementation process, optionally, the process of determining whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked in S105 includes:
under the condition that the file to be verified meets a preset fragmentation condition, segmenting the file to be verified to obtain each fragmentation; calculating a fragment check value of each fragment, and judging whether the check value of each fragment is consistent with a pre-recorded standard fragment check value corresponding to the fragment;
and under the condition that the file to be checked does not meet the preset fragmentation condition, calculating the file check value of the file to be checked, and judging whether the file check value of the file to be checked is consistent with the pre-recorded standard file check value corresponding to the file to be checked.
In this embodiment, the fragmentation condition may be that the storage space capacity occupied by the file to be verified is greater than a preset threshold, and the file to be verified may be fragmented in a preset fragmentation manner to obtain a plurality of fragments when the file to be verified satisfies the fragmentation condition.
Optionally, when the check value of at least one fragment is inconsistent with the check value of the standard fragment corresponding to the fragment, it is determined that the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked, and when all the fragment check values are consistent with the corresponding standard fragment check values, it is determined that the check value of the file to be checked is inconsistent with the standard check value corresponding to the file to be checked.
Optionally, under the condition that the file verification value of the file to be verified is the standard file verification value corresponding to the file to be verified, it is determined that the verification value of the file to be verified is consistent with the verification value of the standard file.
In an embodiment of the present invention, based on the implementation process, optionally, the process of comparing the file to be checked with the standard file corresponding to the file to be checked, as shown in fig. 2, may include:
s201: and respectively preprocessing the file to be checked and the standard file to remove invalid information in the file to be checked and the standard file.
In this embodiment, the invalidation information may invalidate at least one of a trade line and an invalid space.
S202: and calculating the matching degree between the preprocessed file to be checked and the preprocessed standard file.
In this embodiment, a cosine distance algorithm or an edit distance algorithm may be used to calculate a matching degree between the file to be checked and the standard file, where the matching degree may represent a distance or a similarity between the file to be checked and the standard file, and the matching degree may range from 0 to 1, and the closer to 1, the more similar the two files are.
S203: and under the condition that the matching degree meets a preset matching degree threshold value, determining that the file to be verified and the standard file pass through comparison.
In this embodiment, the threshold of the matching degree may be 1, and when the matching degree is 1, it is determined that the file to be checked and the standard file pass through the comparison.
S204: and under the condition that the matching degree does not meet a preset matching degree threshold value, determining that the comparison between the file to be checked and the standard file does not pass.
In an embodiment provided by the present invention, based on the implementation process, optionally, the implementation process further includes:
and under the condition that the file directory information is inconsistent with standard file directory information corresponding to the distributed program to be processed, determining that the file directory information is abnormal, and outputting a part inconsistent with the standard file target information in the file directory information.
The method provided by the embodiment of the invention can be applied to the verification of the program files of various distributed programs. In the practical application process, referring to fig. 3, a flowchart of a file processing process provided in the embodiment of the present invention is shown, in which standard information is collected first, then information verification is initialized, and then daily information verification is performed.
In this embodiment, the process of collecting standard information is shown in fig. 4, a set of standard program directories may be selected from a plurality of sets of distributed programs, where the directory is an already-defined standard program directory, the program directory is used as a reference, the directory and all objects under the directory are traversed recursively, if the traversed and selected object is a link or a directory, the traversal is skipped directly, if the object is a file, it is determined whether the file is a text file, if the file is a non-text file, an MD5 hash value of the file is directly calculated, if the program file is a text file, the size of the file is obtained, and when the file exceeds a specified size, the file is sliced, and an MD5 value of each slice is recorded; the standard information may include MD5 values and file name and path information for the file.
After the standard information is collected, information verification is initialized, and as shown in fig. 5, each set of distributed programs to be compared may be compared with a standard program directory, a link and a file only compare a name, and a file compares an MD5 value or a fragment MD5 value thereof, and if the MD5 value or the fragment MD5 value is inconsistent, the target file is overwritten with the standard file. When the values of the MD5 of the file are the same, the modification information of the file and the value of the MD5 or the value of the slice MD5 are recorded in a local configuration file for the next time of comparison.
Further, after the initialized information is checked, performing daily information checking, as shown in fig. 6, performing distributed program checking by using a fast distributed program consistency checking method for daily information checking, performing consistency checking on the distributed program according to the comparison frequency required by the operation and maintenance staff, and comparing the contents of the program files. When comparing, firstly comparing directory structures to ensure the consistency of the directory structures of the files, then comparing the modification time of the files, if the modification time of the files is the initialized modification time of the local configuration files of the distributed program, directly judging that the files are not changed, if not, starting to compare the MD5 value or the slice MD5 value of the files, if the MD5 value or the slice MD5 value is consistent with the value recorded on the local configuration files, judging that the files are not changed, only modifying the modification time of the files in the local configuration files at the moment, if not, carrying out strong consistency check on the files, carrying out strong consistency check by adopting a format tower mode matching and an automatic garbage heuristic algorithm, processing each line of a standard text file and each line of a program to be compared, finding out the longest continuous matching sequence without garbage elements (empty lines and blank spaces), matching, and calculating the matching degree of the whole text, if the matching degree is 1, judging that the file is normal, only modifying the modification time of the file in the local configuration file, otherwise, judging that the text file automatically does not contain the step of identifying the file as an abnormal file, selecting a standard file for covering, and outputting abnormal information.
In this embodiment, to solve the problem of Hash collision of the MD5 algorithm and the problem of slow verification speed of the large text file MD5, the present invention provides a fast MD5 Hash algorithm, which divides a text file exceeding a certain size into one subfile every N rows, provides a multithreading technique, and calculates and compares Hash values of the fragmented MD5 files using multiple threads, and this algorithm makes full use of a multi-core server, thereby effectively increasing the calculation speed of the MD5, and at the same time, due to the adoption of the fragmentation technique, reduces a keyword set, further reduces an address set of information verified by the MD5, and reduces the probability of Hash collision of the MD5 algorithm.
In this embodiment, a strong consistency text matching algorithm based on a format tower mode is adopted, and the algorithm is a similarity calculation method used in this embodiment, and is used as a supplement method of an MD5 fragmentation algorithm, and is mainly used for removing and comparing junk added with invalid line feeds, spaces and the like in a text, and comparing files in an understandable way.
By applying the method provided by the embodiment, through a distributed program consistency verification method based on file modification time, a fragment MD5 algorithm and a strong consistency text matching algorithm, the speed is higher than that of the traditional single file MD5 algorithm, the time consumed by verification is reduced by about 50% when a quad-core server is used for verifying a large file actually, the fragment algorithm reduces the range of an address set input by the HASH algorithm to a certain extent, the probability of Hash collision is reduced, when all fragments are verified successfully, the algorithm judges that the files are the same file, the reliability of the MD5 algorithm is increased to a certain extent, besides the advantages, strong consistency comparison of the text is provided, after meaningless information such as invalid line change, blank space and the like in the text is removed, the text files are compared, and the similarity is calculated, so that whether the texts are consistent or not is confirmed.
Corresponding to the method illustrated in fig. 1, an embodiment of the present invention further provides a file processing apparatus, which is used for specifically implementing the method illustrated in fig. 1, where the file processing apparatus provided in the embodiment of the present invention may be applied to an electronic device, and a schematic structural diagram of the file processing apparatus is illustrated in fig. 7, and specifically includes:
an obtaining unit 701, configured to obtain, in response to the check instruction, file directory information of the to-be-processed distributed program;
a determining unit 702, configured to determine, when the file directory information is consistent with standard file directory information corresponding to the to-be-processed distributed program, a to-be-verified file under the file directory information;
a first determining unit 703, configured to determine whether the modification time of the file to be verified is consistent with a standard modification time corresponding to the file to be verified;
a second determining unit 704, configured to determine whether the file to be verified is a text type file when the modification time of the file to be verified is inconsistent with the standard modification time;
a third determining unit 705, configured to determine whether a check value of the file to be checked is consistent with a standard check value corresponding to the file to be checked when the file to be checked is a text-type file;
a comparing unit 706, configured to compare the to-be-checked file with a standard file corresponding to the to-be-checked file when the check value of the to-be-checked file is inconsistent with the standard check value;
a replacing unit 707, configured to replace the to-be-verified file with the standard file when the to-be-verified file does not pass the comparison with the standard file.
In an embodiment provided in the embodiment of the present invention, based on the above scheme, specifically, the third determining unit 705 includes:
the first execution subunit is used for segmenting the file to be verified under the condition that the file to be verified meets a preset segmentation condition to obtain each segment; calculating a fragment check value of each fragment, and judging whether the fragment check value of each fragment is consistent with a pre-recorded standard fragment check value corresponding to the fragment;
and the second execution subunit is used for calculating the file check value of the file to be checked under the condition that the file to be checked does not meet the preset fragmentation condition, and judging whether the file check value of the file to be checked is consistent with the pre-recorded standard file check value corresponding to the file to be checked.
In an embodiment of the present invention, based on the above scheme, specifically, the comparing unit 706 includes:
the preprocessing subunit is used for respectively preprocessing the file to be checked and the standard file so as to eliminate invalid information in the file to be checked and the standard file;
the calculation subunit is used for calculating the matching degree between the preprocessed file to be checked and the preprocessed standard file;
the first determining subunit is used for determining that the file to be verified passes the comparison between the file to be verified and the standard file under the condition that the matching degree meets a preset matching degree threshold;
and the second determining subunit is used for determining that the comparison between the file to be verified and the standard file does not pass under the condition that the matching degree does not meet a preset matching degree threshold value.
In an embodiment provided in the embodiment of the present invention, based on the above scheme, specifically, the file processing apparatus further includes:
and the execution unit is used for replacing the file to be checked with the standard file corresponding to the file to be checked if the check value of the file to be checked is inconsistent with the standard check value corresponding to the file to be checked under the condition that the file to be checked is not the text type file.
In an embodiment provided in the embodiment of the present invention, based on the above scheme, specifically, the file processing apparatus further includes:
and the output unit is used for determining that the file directory information is abnormal and outputting a part of the file directory information inconsistent with the standard file target information under the condition that the file directory information is inconsistent with the standard file directory information corresponding to the distributed program to be processed.
The specific principle and the execution process of each unit and each module in the file processing apparatus disclosed in the above embodiment of the present invention are the same as those of the file processing method disclosed in the above embodiment of the present invention, and reference may be made to corresponding parts in the file processing method provided in the above embodiment of the present invention, which are not described herein again.
The embodiment of the invention also provides a storage medium, which comprises stored instructions, wherein when the instructions are executed, the equipment where the storage medium is located is controlled to execute the file processing method.
An electronic device is provided in an embodiment of the present invention, and the structural diagram of the electronic device is shown in fig. 8, which specifically includes a memory 801 and one or more instructions 802, where the one or more instructions 802 are stored in the memory 801 and configured to be executed by the one or more processors 803 to perform the following operations:
responding to the checking instruction, and acquiring file directory information of the distributed program to be processed;
determining a file to be verified under the file directory information under the condition that the file directory information is consistent with standard file directory information corresponding to the distributed program to be processed;
judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked;
under the condition that the modification time of the file to be checked is inconsistent with the standard modification time, judging whether the file to be checked is a text type file or not;
under the condition that the file to be checked is a text type file, judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked;
comparing the file to be checked with a standard file corresponding to the file to be checked under the condition that the check value of the file to be checked is inconsistent with the standard check value;
and under the condition that the comparison between the file to be checked and the standard file does not pass, replacing the file to be checked with the standard file.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in a plurality of software and/or hardware when implementing the invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The above detailed description is provided for a file processing method provided by the present invention, and the principle and the implementation of the present invention are explained by applying specific examples, and the description of the above examples is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A file processing method, comprising:
responding to the checking instruction, and acquiring file directory information of the distributed program to be processed;
under the condition that the file directory information is consistent with the standard file directory information corresponding to the distributed program to be processed, determining a file to be checked under the file directory information;
judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked;
under the condition that the modification time of the file to be verified is inconsistent with the standard modification time, judging whether the file to be verified is a text type file or not;
under the condition that the file to be checked is a text type file, judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked;
under the condition that the check value of the file to be checked is inconsistent with the standard check value, comparing the file to be checked with a standard file corresponding to the file to be checked;
and under the condition that the comparison between the file to be checked and the standard file does not pass, replacing the file to be checked with the standard file.
2. The method according to claim 1, wherein the determining whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked comprises:
under the condition that the file to be verified meets a preset fragmentation condition, segmenting the file to be verified to obtain each fragmentation; calculating a fragment check value of each fragment, and judging whether the fragment check value of each fragment is consistent with a pre-recorded standard fragment check value corresponding to the fragment;
and under the condition that the file to be checked does not meet the preset fragmentation condition, calculating the file check value of the file to be checked, and judging whether the file check value of the file to be checked is consistent with the pre-recorded standard file check value corresponding to the file to be checked.
3. The method according to claim 1, wherein comparing the file to be verified with the standard file corresponding to the file to be verified comprises:
respectively preprocessing the file to be checked and the standard file to remove invalid information in the file to be checked and the standard file;
calculating the matching degree between the preprocessed file to be checked and the preprocessed standard file;
under the condition that the matching degree meets a preset matching degree threshold value, determining that the file to be verified passes the comparison with the standard file;
and under the condition that the matching degree does not meet a preset matching degree threshold value, determining that the comparison between the file to be checked and the standard file does not pass.
4. The method of claim 1, further comprising:
and under the condition that the file to be checked is not a text type file, if the check value of the file to be checked is inconsistent with the standard check value corresponding to the file to be checked, replacing the file to be checked with the standard file corresponding to the file to be checked.
5. The method of claim 1, further comprising:
and under the condition that the file directory information is inconsistent with standard file directory information corresponding to the distributed program to be processed, determining that the file directory information is abnormal, and outputting a part inconsistent with the standard file target information in the file directory information.
6. A document processing apparatus, characterized by comprising:
the acquisition unit is used for responding to the verification instruction and acquiring file directory information of the distributed program to be processed;
the determining unit is used for determining the file to be verified under the file directory information under the condition that the file directory information is consistent with the standard file directory information corresponding to the distributed program to be processed;
the first judgment unit is used for judging whether the modification time of the file to be checked is consistent with the standard modification time corresponding to the file to be checked;
the second judging unit is used for judging whether the file to be checked is a text type file or not under the condition that the modification time of the file to be checked is inconsistent with the standard modification time;
the third judging unit is used for judging whether the check value of the file to be checked is consistent with the standard check value corresponding to the file to be checked or not under the condition that the file to be checked is a text type file;
the comparison unit is used for comparing the file to be checked with the standard file corresponding to the file to be checked under the condition that the check value of the file to be checked is inconsistent with the standard check value;
and the replacing unit is used for replacing the file to be checked by using the standard file under the condition that the comparison between the file to be checked and the standard file fails.
7. The apparatus according to claim 6, wherein the third determining unit comprises:
the first execution subunit is used for segmenting the file to be verified under the condition that the file to be verified meets a preset segmentation condition to obtain each segment; calculating a fragment check value of each fragment, and judging whether the fragment check value of each fragment is consistent with a pre-recorded standard fragment check value corresponding to the fragment;
and the second execution subunit is used for calculating the file check value of the file to be checked under the condition that the file to be checked does not meet the preset fragmentation condition, and judging whether the file check value of the file to be checked is consistent with the pre-recorded standard file check value corresponding to the file to be checked.
8. The apparatus of claim 6, wherein the alignment unit comprises:
the preprocessing subunit is used for respectively preprocessing the file to be checked and the standard file so as to eliminate invalid information in the file to be checked and the standard file;
the calculation subunit is used for calculating the matching degree between the preprocessed file to be checked and the preprocessed standard file;
the first determining subunit is configured to determine that the file to be verified passes the comparison between the standard file and the file to be verified when the matching degree meets a preset matching degree threshold;
and the second determining subunit is used for determining that the comparison between the file to be verified and the standard file does not pass under the condition that the matching degree does not meet a preset matching degree threshold value.
9. A storage medium, characterized in that the storage medium comprises storage instructions, wherein when the instructions are executed, a device on which the storage medium is located is controlled to execute the file processing method according to any one of claims 1 to 5.
10. An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by the one or more processors to perform the file processing method of any one of claims 1-5.
CN202210798969.2A 2022-07-08 2022-07-08 File processing method and device, storage medium and electronic equipment Pending CN115129669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210798969.2A CN115129669A (en) 2022-07-08 2022-07-08 File processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210798969.2A CN115129669A (en) 2022-07-08 2022-07-08 File processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115129669A true CN115129669A (en) 2022-09-30

Family

ID=83381722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210798969.2A Pending CN115129669A (en) 2022-07-08 2022-07-08 File processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115129669A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116467756A (en) * 2023-03-13 2023-07-21 阿里巴巴(中国)有限公司 Application program verification method, packaging method, processor and terminal equipment
CN117034038A (en) * 2023-09-07 2023-11-10 网易(杭州)网络有限公司 Resource comparison method and device, computer storage media, electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954353A (en) * 2015-02-10 2015-09-30 腾讯科技(深圳)有限公司 Verification method and apparatus of APK file package
CN105373747A (en) * 2015-12-09 2016-03-02 上海斐讯数据通信技术有限公司 File generation method, file verification method and systems for preventing system from being tampered
CN106445485A (en) * 2016-03-28 2017-02-22 中国电力科学研究院 Software version consistency detection system and detection method thereof
CN107343007A (en) * 2017-07-17 2017-11-10 广西科技大学 Distributed file management method and system based on user identity and purview certification
CN109977082A (en) * 2019-03-12 2019-07-05 福建省农村信用社联合社 A kind of method and computer readable storage medium of high-volume data automatic comparison
CN113051401A (en) * 2021-04-06 2021-06-29 明品云(北京)数据科技有限公司 Text structured labeling method, system, device and medium
WO2021174882A1 (en) * 2020-09-02 2021-09-10 平安科技(深圳)有限公司 Data fragment verification method, apparatus, computer device, and readable storage medium
CN114491666A (en) * 2022-01-10 2022-05-13 深圳Tcl新技术有限公司 File checking method and device and computer readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954353A (en) * 2015-02-10 2015-09-30 腾讯科技(深圳)有限公司 Verification method and apparatus of APK file package
CN105373747A (en) * 2015-12-09 2016-03-02 上海斐讯数据通信技术有限公司 File generation method, file verification method and systems for preventing system from being tampered
CN106445485A (en) * 2016-03-28 2017-02-22 中国电力科学研究院 Software version consistency detection system and detection method thereof
CN107343007A (en) * 2017-07-17 2017-11-10 广西科技大学 Distributed file management method and system based on user identity and purview certification
CN109977082A (en) * 2019-03-12 2019-07-05 福建省农村信用社联合社 A kind of method and computer readable storage medium of high-volume data automatic comparison
WO2021174882A1 (en) * 2020-09-02 2021-09-10 平安科技(深圳)有限公司 Data fragment verification method, apparatus, computer device, and readable storage medium
CN113051401A (en) * 2021-04-06 2021-06-29 明品云(北京)数据科技有限公司 Text structured labeling method, system, device and medium
CN114491666A (en) * 2022-01-10 2022-05-13 深圳Tcl新技术有限公司 File checking method and device and computer readable storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116467756A (en) * 2023-03-13 2023-07-21 阿里巴巴(中国)有限公司 Application program verification method, packaging method, processor and terminal equipment
CN116467756B (en) * 2023-03-13 2025-07-18 阿里巴巴(中国)有限公司 Application verification method, packaging method, processor and terminal device
CN117034038A (en) * 2023-09-07 2023-11-10 网易(杭州)网络有限公司 Resource comparison method and device, computer storage media, electronic equipment
CN117034038B (en) * 2023-09-07 2025-11-18 网易(杭州)网络有限公司 Resource comparison methods and apparatus, computer storage media, electronic equipment

Similar Documents

Publication Publication Date Title
KR102010468B1 (en) Apparatus and method for verifying malicious code machine learning classification model
CN110321466B (en) Securities information duplicate checking method and system based on semantic analysis
US10650274B2 (en) Image clustering method, image clustering system, and image clustering server
CN108073815B (en) Family judgment method and system based on code slice and storage medium
CN103370692A (en) Method and apparatus for restoring data
CN115129669A (en) File processing method and device, storage medium and electronic equipment
CN114238257A (en) Log processing method, log processing device and electronic equipment
CN120235162B (en) A text processing method and system based on semantic density
US8549309B1 (en) Asymmetric content fingerprinting with adaptive window sizing
CN115269288A (en) Fault determination method, device, equipment and storage medium
US20230409521A1 (en) Automatic preservation
US8805803B2 (en) Index extraction from documents
CN113721923B (en) Webpage code optimization method and device, electronic equipment and storage medium
CA2734207C (en) Electronic file comparator
CN118861534B (en) Method and device for detecting electronic file of pumping and accumulating engineering, storage medium and terminal
CN113535470A (en) Configuration backup method and device, electronic equipment and storage medium
CN119248715A (en) A method and system for quickly extracting archive information
CN119249020A (en) Artificial intelligence-based website map generation method, system, device and medium
CN114564472B (en) Metadata expansion method, storage medium and electronic device
CN114357394A (en) Data flow correlation identification method and device, electronic equipment and storage medium
CN121119449B (en) Method, device, equipment and medium for detecting conflict of financial institution system information
CN107168997B (en) Webpage originality assessment method and device based on artificial intelligence and storage medium
CN119538916B (en) Abnormal vocabulary detection method, device, computer equipment and storage medium
CN112749294A (en) Page hidden file identification method and device, computer equipment and storage medium
CN121071146B (en) A document tagging method and system based on entity augmentation and multi-granularity fusion

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20220930