Data backup method and device, equipment and storage medium

By merging and processing the sub-files in the initial file, and backing up the target file after generating it, the problem of low backup efficiency for massive small files is solved and the backup efficiency is improved.

CN119917346APending Publication Date: 2025-05-02PEOPLE'S INSURANCE COMPANY OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510005669.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The backup process of massive small files is low in efficiency, resulting in long backup time and inefficient efficiency.

Method used

By merging the subfiles in the initial file, a target file is generated, which includes multiple first-level subfiles in the target file, and then the target file is backed up.

Benefits of technology

By merging sub-files in advance, the terminal device can avoid opening, reading, and closing operations on a large number of files, which significantly improves the efficiency of file backup.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917346A_ABST
    Figure CN119917346A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data backup method and device, equipment and a storage medium. The method comprises the steps that an initial file to be backed up and a file directory of the initial file are determined, the initial file comprises a plurality of sub-files, and the file levels of the sub-files are larger than or equal to 1; determining the file size of each sub-file in the initial file; determining the number of subordinate sub-files corresponding to each sub-file according to the file directory; according to the file directory, the file size of each sub-file in the initial file and the number of subordinate sub-files corresponding to each sub-file, the sub-files in the initial file are combined to obtain a target file, and the target file comprises a plurality of first-level sub-files; and performing file backup processing on the target file. And the data backup efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a data backup method, device, equipment and storage medium. Background Art

[0002] In some scenarios, applications or services will continuously generate small files, such as pictures cached in a personal computer, emails saved in a database, etc. However, these files may be lost when hardware failure or human error occurs.

[0003] In the related art, the loss caused by file loss can be reduced by backing up in advance. The backup of a large number of small files usually requires reading the files one by one before backing them up, that is, this method requires opening, reading, backing up and closing each small file to complete the backup.

[0004] However, in the above process, when the number of small files is extremely large, a lot of time is consumed, making the entire backup process extremely slow, resulting in low efficiency of file backup. Summary of the invention

[0005] The embodiments of the present application provide a data backup method, apparatus, device and storage medium to solve the problem of low efficiency in backing up massive small files.

[0006] In a first aspect, an embodiment of the present application provides a data backup method, including:

[0007] Determine an initial file to be backed up and a file directory of the initial file, wherein the initial file includes a plurality of sub-files, and the file levels of the plurality of sub-files are greater than or equal to 1;

[0008] Determine the file size of each sub-file in the initial file;

[0009] According to the file directory, determine the number of subordinate sub-files corresponding to each sub-file;

[0010] According to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file, the sub-files in the initial file are merged to obtain a target file, wherein the target file includes a plurality of first-level sub-files;

[0011] Perform file backup processing on the target file.

[0012] In a possible implementation, merging the sub-files in the initial file to obtain the target file according to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file includes:

[0013] According to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, wherein the file size of each sub-file in the first file is greater than or equal to a first threshold;

[0014] According to the number of subordinate sub-files corresponding to each sub-file in the first file, the sub-files in the first file are merged to obtain a second file;

[0015] The file level of each sub-file in the second file is set to level one to obtain the target file.

[0016] In a possible implementation, according to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, including:

[0017] According to the file directory and the file size of each sub-file in the initial file, performing a first merging process on the sub-files in the initial file to obtain a first intermediate file;

[0018] According to the file directory and the file size of each sub-file in the i-th intermediate file, performing an i+1th merging process on the sub-files in the i-th intermediate file to obtain an i+1th intermediate file;

[0019] Among them, the i is 1, 2, 3... in sequence, until the file sizes of each leaf file in the Mth intermediate file are respectively greater than or equal to the first threshold, the Mth intermediate file is determined as the first file, and M is an integer greater than or equal to 1.

[0020] In a possible implementation, according to the file directory and the file size of each sub-file in the initial file, performing a first merging process on the sub-files in the initial file to obtain a first intermediate file includes:

[0021] According to the file directory, a plurality of leaf files are determined in each subfile of the initial file, wherein the leaf files do not have a next-level file;

[0022] Determine a target leaf file from the plurality of leaf files according to the file size of each leaf file, wherein the file size of the target leaf file is smaller than the first threshold;

[0023] The target leaf file is merged into the parent file of the target leaf file to obtain the first intermediate file, and the target leaf file is the next level file of the parent file.

[0024] In a possible implementation, merging the subfiles in the first file according to the number of subordinate subfiles corresponding to each subfile in the first file to obtain the second file includes:

[0025] Determine a target subfile in the subfiles of the first file according to the number of subordinate subfiles corresponding to each subfile, wherein the number of subordinate subfiles corresponding to the target subfile is less than a second threshold;

[0026] A target parent file of the target child file is determined, and the target child file and subordinate child files of the target child file are merged into the target parent file to obtain the second file.

[0027] In a possible implementation, performing file backup processing on the target file includes:

[0028] Read each sub-file in the target file;

[0029] Each sub-file in the target file is stored in a preset database to implement file backup processing for the target file.

[0030] In a possible implementation, the method further includes:

[0031] Obtaining a recovery request corresponding to the initial file;

[0032] According to the restoration request, obtaining the target file in a preset database;

[0033] According to the file directory, the sub-files of the target file are split and processed to obtain the initial file.

[0034] In a second aspect, an embodiment of the present application provides a data backup device, including: a first determination module, a second determination module, a third determination module, a merging module and a backup module, wherein:

[0035] The first determination module is used to determine an initial file to be backed up and a file directory of the initial file, wherein the initial file includes a plurality of sub-files, and the file levels of the plurality of sub-files are greater than or equal to 1;

[0036] The second determining module is used to determine the file size of each sub-file in the initial file;

[0037] The third determination module is used to determine the number of subordinate sub-files corresponding to each sub-file according to the file directory;

[0038] The merging module is used to merge the sub-files in the initial file according to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file to obtain a target file;

[0039] The backup module is used to perform file backup processing on the target file.

[0040] In a possible implementation, the merging module is specifically used for:

[0041] According to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, wherein the file size of each sub-file in the first file is greater than or equal to a first threshold;

[0042] According to the number of subordinate sub-files corresponding to each sub-file in the first file, the sub-files in the first file are merged to obtain a second file;

[0043] The file level of each sub-file in the second file is set to level one to obtain the target file.

[0044] In a possible implementation, the merging module is specifically used for:

[0045] According to the file directory and the file size of each sub-file in the initial file, performing a first merging process on the sub-files in the initial file to obtain a first intermediate file;

[0046] According to the file directory and the file size of each sub-file in the i-th intermediate file, performing an i+1th merging process on the sub-files in the i-th intermediate file to obtain an i+1th intermediate file;

[0047] Among them, the i is 1, 2, 3... in sequence, until the file sizes of each leaf file in the Mth intermediate file are respectively greater than or equal to the first threshold, the Mth intermediate file is determined as the first file, and M is an integer greater than or equal to 1.

[0048] In a possible implementation, the merging module is specifically used for:

[0049] According to the file directory, a plurality of leaf files are determined in each subfile of the initial file, wherein the leaf files do not have a next-level file;

[0050] Determine a target leaf file from the plurality of leaf files according to the file size of each leaf file, wherein the file size of the target leaf file is smaller than the first threshold;

[0051] The target leaf file is merged into the parent file of the target leaf file to obtain the first intermediate file, and the target leaf file is the next level file of the parent file.

[0052] In a possible implementation, the merging module is specifically used for:

[0053] Determine a target subfile in the subfiles of the first file according to the number of subordinate subfiles corresponding to each subfile, wherein the number of subordinate subfiles corresponding to the target subfile is less than a second threshold;

[0054] A target parent file of the target child file is determined, and the target child file and subordinate child files of the target child file are merged into the target parent file to obtain the second file.

[0055] In a possible implementation manner, the backup module is specifically used to:

[0056] Read each sub-file in the target file;

[0057] Each sub-file in the target file is stored in a preset database to implement file backup processing for the target file.

[0058] In a possible implementation, the device further includes: a first acquisition module, a second acquisition module, and a splitting module, wherein:

[0059] The first acquisition module is used to obtain a recovery request corresponding to the initial file;

[0060] The second acquisition module is used to acquire the target file from a preset database according to the restoration request;

[0061] The splitting module is used to split the sub-files of the target file according to the file directory to obtain the initial file.

[0062] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the data backup method described in the first aspect and various possible designs of the first aspect.

[0063] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the data backup method described in the first aspect and various possible designs of the first aspect is implemented.

[0064] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the data backup method described in the first aspect and various possible designs of the first aspect.

[0065] The data backup method, apparatus, device and storage medium provided in the embodiments of the present application can first merge the sub-files in the initial file to obtain the target file when the user needs to back up the initial file, and then back up the target file. By merging the sub-files in advance, the terminal device can avoid opening, reading and closing a large number of files, thereby improving the efficiency of file backup. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0067] Figure 1 A schematic diagram of the system architecture provided for an embodiment of the present application;

[0068] Figure 2 A flowchart of a data backup method provided in an embodiment of the present application;

[0069] Figure 3 A schematic diagram of a target file determination process provided in an embodiment of the present application;

[0070] Figure 4 A schematic diagram of a file directory of an initial file provided in an embodiment of the present application;

[0071] Figure 5 A schematic diagram of the file sizes of sub-files of an initial file provided in an embodiment of the present application;

[0072] Figure 6 A schematic diagram of the merging process provided in an embodiment of the present application;

[0073] Figure 7 A schematic diagram of a first file provided in an embodiment of the present application;

[0074] Figure 8 A schematic diagram of another first file provided in an embodiment of the present application;

[0075] Fig. 9 A schematic diagram of a process for determining a second file provided in an embodiment of the present application;

[0076] Fig.10 A schematic diagram of a target file determination process provided in an embodiment of the present application;

[0077] Fig.11A schematic diagram of the structure of a data backup device provided in an embodiment of the present application;

[0078] Fig.12 A schematic diagram of another data backup device provided in an embodiment of the present application;

[0079] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0080] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0081] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0082] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0083] For ease of understanding, the following Figure 1 , the system architecture applicable to the embodiments of the present application is described.

[0084] Figure 1 This is a schematic diagram of the system architecture provided by the embodiment of this application. Figure 1 , including a terminal device 101 and a storage device 102. The terminal device 101 may be a local device of a user, and a large number of files are stored in the terminal device 101. The terminal device 101 may be provided with a software tool, and the user may back up files and restore files through the software tool. The storage device 102 may be used to store backup data, and the storage device 102 may be a USB flash drive, a hard disk, or a cloud storage device. The terminal device 101 may store the backup data of the file in the storage device 102, and may also restore the backup data of the file from the storage device 102.

[0085] In the related art, the loss caused by file loss can be reduced by backing up in advance. The backup of a large number of small files usually requires reading the files one by one before backing them up, that is, this method requires opening, reading, backing up and closing each small file to complete the backup. However, in the above process, when the number of small files is extremely large, a lot of time is consumed, making the entire backup process extremely slow, resulting in low efficiency of file backup.

[0086] In response to the above technical problems, in an embodiment of the present application, when the user needs to back up an initial file, the sub-files in the initial file can be merged first to obtain a target file, and then the target file can be backed up. By merging the sub-files in advance, the terminal device can avoid opening, reading, and closing a large number of files, thereby improving the efficiency of file backup.

[0087] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0088] Figure 2 A flowchart of a data backup method provided in an embodiment of the present application. Figure 2 As shown, the method may include the following steps:

[0089] S201: Determine the initial file to be backed up and the file directory of the initial file.

[0090] The execution subject of the embodiment of the present application may be a terminal device, or a backup device arranged in the terminal device. The backup device may be implemented by software, or by a combination of software and hardware.

[0091] The initial file may refer to a file that the user sets in advance to be backed up, and the user may set the storage address of the initial file in the backup software in the terminal device. The initial file may include multiple sub-files, and the file levels of the multiple sub-files are greater than or equal to 1.

[0092] The terminal device may scan the initial file to determine the file directory of the initial file, wherein the file directory may include all files in the initial file and their directory structure.

[0093] S202: Determine the file size of each sub-file in the initial file.

[0094] The terminal device obtains the size of each sub-file of the initial file and saves it in a preset database. The preset database can be stored in a storage device, which can be a USB flash drive, a solid state drive, or a cloud storage device.

[0095] The file size of each sub-file may be expressed in bytes. For example, the file size of a sub-file may be 3 KB, 15 KB, and so on.

[0096] S203: Determine the number of subordinate sub-files corresponding to each sub-file according to the file directory.

[0097] The number of subordinate subfiles can be 0 or an integer greater than 0. When the number of subordinate subfiles corresponding to a subfile is 0, the subfile is the last subfile of the file directory. The number of subordinate subfiles corresponding to a subfile can be 0, 1, 2, 3, 4, 5, etc.

[0098] For example, if there is no subfile in subfile 1, the number of subordinate subfiles of subfile 1 is 0. If there is subfile 2 in subfile 1 and there is no subfile in subfile 2, the number of subordinate subfiles of subfile 1 is 1 and the number of subordinate subfiles of subfile 2 is 0.

[0099] S204: According to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file, the sub-files in the initial file are merged to obtain a target file.

[0100] The target file can be obtained in the following manner: according to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, and the file size of each sub-file in the first file is greater than or equal to a first threshold; according to the number of subordinate sub-files corresponding to each sub-file in the first file, the sub-files in the first file are merged to obtain a second file; and the file level of each sub-file in the second file is set to level one to obtain the target file. The target file includes multiple level one sub-files.

[0101] Among them, the first threshold can be a value set in advance by the user on the terminal device, which is used to determine whether the sub-files in the initial file need to be merged, that is, if the file size of the sub-file is greater than or equal to the first threshold, no merging is performed; if the file size of the sub-file is less than the first threshold, merging is required.

[0102] S205: Back up the target file.

[0103] The file backup process can be performed in the following manner: reading each sub-file in the target file; storing each sub-file in the target file in a preset database, so as to perform the file backup process on the target file.

[0104] In actual application, after backing up the target file, the initial file can also be restored, wherein the restoration process refers to restoring the target file stored in the preset database to the initial file.

[0105] The initial file can be restored in the following manner: obtaining a restoration request corresponding to the initial file; obtaining a target file in a preset database according to the restoration request; and splitting sub-files of the target file according to the file directory to obtain the initial file.

[0106] The restoration request corresponding to the initial file may include a storage address of a target file corresponding to the initial file in a preset database.

[0107] The terminal device may obtain a file directory of the initial file, and the file directory may indicate the original location of the sub-file in the initial file.

[0108] In an embodiment of the present application, when it is necessary to perform data backup on an initial file, the file size of each subfile of the initial file and the number of subordinate subfiles corresponding to each subfile can be obtained first, and the subfiles in the initial file can be merged according to the file directory of the initial file, the file size of each subfile in the initial file, and the number of subordinate subfiles corresponding to each subfile to obtain a target file including multiple first-level subfiles. The target file is then backed up. By merging the subfiles in advance, the terminal device can avoid executing operations of opening, reading, and closing subfiles on a large number of files, thereby improving the efficiency of file backup.

[0109] Based on any of the above embodiments, Figure 3 , the data backup process is explained in detail.

[0110] Figure 3 Schematic diagram of the process of determining the target file provided in the embodiment of the present application. Figure 3 , the method may include:

[0111] S301: Determine the initial file to be backed up and the file directory of the initial file.

[0112] S302: Determine the file size of each sub-file in the initial file.

[0113] S303: Determine the number of subordinate sub-files corresponding to each sub-file according to the file directory.

[0114] It should be noted that the execution process of the above S301-S303 can refer to S201-S203, which will not be repeated here.

[0115] S304: Determine a plurality of leaf files in each subfile of the initial file according to the file directory.

[0116] A leaf file refers to a subfile that does not have a next-level file.

[0117] Next, combine Figure 4 , leaf files are explained through specific examples.

[0118] Figure 4 For a schematic diagram of the file directory of the initial file provided in the embodiment of this application, see Figure 4 . Each circle represents a sub-file. If there is no next-level file for the sub-file AM, then the sub-file AM ​​can be determined as a leaf file in the file directory.

[0119] S305. Determine a target leaf file from multiple leaf files according to the file size of each leaf file, and the file size of the target leaf file is smaller than a first threshold.

[0120] The first threshold may be a value pre-set by the user on the terminal device. For example, the first threshold may be 10 KB, 20 KB, etc.

[0121] The terminal device compares the first threshold and the file size of each leaf file in turn, and if the file size of the leaf file is smaller than the first threshold, the leaf file is determined as the target leaf file.

[0122] For example, assuming that the size of a leaf file is 5 KB and the first threshold is 10 KB, the leaf file is the target leaf file.

[0123] Next, combine Figure 5 , the target leaf file is explained through specific examples.

[0124] Figure 5 For a schematic diagram of the file sizes of the sub-files of the initial file provided in the embodiment of the present application, see Figure 5 , where each circle represents a subfile, and the number in the circle represents the file size of the subfile. Assuming the first threshold is 10KB, the file size of leaf file A is 1 KB, the file size of leaf file B is 2 KB, the file size of leaf file C is 5 KB, the file size of leaf file D is 6 KB, the file size of leaf file E is 1 KB, the file size of leaf file F is 2 KB, and the file size of leaf file G is 5 KB. Then the file sizes of leaf files AG are all smaller than the first threshold, and leaf files AG can be determined as the target leaf files in the initial file.

[0125] S306: Merge the target leaf files to obtain a first intermediate file.

[0126] The merging process refers to merging the target leaf file into the parent file of the target leaf file, where the parent file is the parent file of the target leaf file.

[0127] After the merge process, the parent file of the target leaf file is updated to the leaf file of the first intermediate file.

[0128] Next, combine Figure 6 , the process of merging is explained through specific examples.

[0129] Figure 6 For a schematic diagram of the merging process provided in the embodiment of the present application, please refer to Figure 6 , including the file directory of the initial file and the file directory of the first intermediate file. Since the target leaf file A and the target leaf file B are determined as the target leaf files, and the upper level files of the target leaf file A and the target leaf file B are the parent file H, the target leaf file A and the target leaf file B are merged into the parent file H; since the target leaf file C and the target leaf file D are determined as the target leaf files, and the upper level files of the target leaf file C and the target leaf file D are the parent file I, the target leaf file C and the target leaf file D are merged into the parent file I; since the target leaf file E is determined as the target leaf file, and the upper level file of the target leaf file E is the parent file J, the target leaf file E is merged into the parent file J; since the target leaf file F is determined as the target leaf file, and the upper level file of the target leaf file F is the parent file K, the target leaf file F is merged into the parent file K; since the target leaf file G is determined as the target leaf file, and the upper level file of the target leaf file G is the parent file L, the target leaf file G is merged into the parent file L, and the first intermediate file can be obtained.

[0130] S307. Initialize i to 1.

[0131] S308: The terminal device obtains the file directory of the i-th intermediate file, and determines a plurality of leaf files in each subfile of the i-th intermediate file.

[0132] S309: Determine whether there is any leaf file in the i-th intermediate file whose file size is smaller than a first threshold.

[0133] If yes, execute S310.

[0134] If not, execute S313.

[0135] S310. Determine a target leaf file among multiple leaf files.

[0136] Among them, the file size of the target leaf file is smaller than the first threshold.

[0137] S311. Merge the target leaf file into the parent file of the target leaf file to obtain the (i+1)th intermediate file.

[0138] S312, add i+1.

[0139] S313: Determine the i-th intermediate file as the first file.

[0140] Assuming that when i=M, the file size of each leaf file in the Mth intermediate file is respectively greater than or equal to the first threshold, the Mth intermediate file is determined as the first file, where M is an integer greater than or equal to 1.

[0141] Next, combine Figure 7 , the first file is explained through a specific example.

[0142] Figure 7 For the first file diagram provided in the embodiment of this application, please refer to Figure 7 , where when i=M, the Mth intermediate file can be obtained. Assuming that the first threshold is 10KB, the file size of leaf file A is 10KB, the file size of leaf file B is 10KB, the file size of leaf file C is 15KB, the file size of leaf file D is 12KB, the file size of leaf file E is 13KB, the file size of leaf file F is 10KB, the file size of leaf file G is 10KB, the file size of leaf file H is 16KB, and the file size of leaf file I is 12KB, that is, the file size of each leaf file in the Mth intermediate file is greater than or equal to the first threshold, respectively, and the Mth intermediate file can be determined as the first file.

[0143] S314: Determine the number of subordinate sub-files corresponding to each sub-file in the first file.

[0144] The terminal device obtains the file directory of the first file, and determines the number of subordinate sub-files corresponding to each sub-file according to the file directory.

[0145] S315 . Determine a target subfile in the subfiles of the first file according to the number of subordinate subfiles corresponding to each subfile.

[0146] The number of subordinate subfiles corresponding to the target subfile is less than a second threshold. The second threshold is a value set in advance by the user on the terminal device and is used to determine the target subfile. For example, the second threshold may be 2, 3, etc.

[0147] Next, combine Figure 8 , another first file is described through a specific example.

[0148] Figure 8 For another first file schematic diagram provided in the embodiment of the present application, please refer to Figure 8, where the number in the circle represents the number of subordinate subfiles corresponding to the subfile. Assuming the second threshold is 2, the number of subordinate subfiles corresponding to subfile a is 1, the number of subordinate subfiles corresponding to subfile b is 0, the number of subordinate subfiles corresponding to subfile c is 1, the number of subordinate subfiles corresponding to subfile d is 0, the number of subordinate subfiles corresponding to subfile e is 0, the number of subordinate subfiles corresponding to subfile f is 0, the number of subordinate subfiles corresponding to subfile g is 1, the number of subordinate subfiles corresponding to subfile h is 1, the number of subordinate subfiles corresponding to subfile i is 0, the number of subordinate subfiles corresponding to subfile j is 0, and the number of subordinate subfiles corresponding to subfile k is 0, then the number of subordinate subfiles corresponding to subfile ak is less than the second threshold, and subfile ak can be determined as the target subfile.

[0149] S316: Determine the target parent file of the target sub-file, and merge the target sub-file and the subordinate sub-files of the target sub-file into the target parent file to obtain a second file.

[0150] The target parent file is the parent file of the target child file.

[0151] Next, combine Fig. 9 , the process of determining the second file is explained through a specific example.

[0152] Fig. 9 For a schematic diagram of the process of determining the second file provided in the embodiment of the present application, please refer to Fig. 9 , the target sub-files in the first file are merged, wherein the target sub-file ac is merged into the target parent file l, the target sub-file d and the target sub-file e are merged into the target parent file m, the target sub-file g and the target sub-file h are merged into the target parent file n, the target sub-file ik is merged into the target parent file o, and the target sub-file f is merged into the target parent file p, and the second file can be obtained.

[0153] S317: Set the file level of each sub-file in the second file to level one, and obtain the target file.

[0154] The terminal device determines the file levels corresponding to all subfiles of the second file, searches for all subfiles with file levels greater than level one, and sets their file levels to level one to obtain the target file, that is, the file levels of all subfiles of the target file are level one and there is no next level file.

[0155] The file level refers to the level of the sub-file in its file directory. The file level can be an integer greater than 0. For example, the file level can be level one, level two, etc.

[0156] Next, combine Fig.10, the process of determining the target file is explained through specific examples.

[0157] Fig.10 For a schematic diagram of the process of determining the target file provided in the embodiment of the present application, please refer to Fig.10 , where in the second file, the file levels of subfiles l, m and q are level one, and the file levels of subfiles n and o are level two; after setting the file levels of subfiles n and o to level one, the target file can be obtained.

[0158] In an embodiment of the present application, when data backup is required, multiple leaf files can be determined in the initial file, and a target leaf file whose file size is less than a first threshold value can be determined from the multiple leaf files, and the target leaf files are merged to obtain a first intermediate file; it is determined whether there is a leaf file smaller than the first threshold value in the first intermediate file, and if so, the i+1th merge process is performed on the i-th intermediate file to obtain the i+1th intermediate file; if not, the current Mth intermediate file is determined as the first file; a target sub-file whose number of subordinate sub-files is less than a second threshold value is determined in the first file, and the target sub-file and the subordinate sub-files of the target sub-file are merged into the target parent file to obtain a second file; the file level of each sub-file in the second file is set to level one to obtain a target file, and then the target file is backed up. By merging the sub-files in advance, the terminal device can avoid performing operations of opening, reading, and closing sub-files on a large number of files, thereby improving the efficiency of file backup.

[0159] Fig.11 This is a schematic diagram of the structure of a data backup device provided in an embodiment of the present application. Fig.11 The data backup device 10 includes: a first determination module 11, a second determination module 12, a third determination module 13, a merging module 14 and a backup module 15, wherein:

[0160] The first determination module 11 is used to determine an initial file to be backed up and a file directory of the initial file, wherein the initial file includes a plurality of sub-files, and the file levels of the plurality of sub-files are greater than or equal to 1;

[0161] The second determining module 12 is used to determine the file size of each sub-file in the initial file;

[0162] The third determination module 13 is used to determine the number of subordinate sub-files corresponding to each sub-file according to the file directory;

[0163] The merging module 14 is used to merge the sub-files in the initial file according to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file to obtain a target file;

[0164] The backup module 15 is used to perform file backup processing on the target file.

[0165] A data backup device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0166] In a possible implementation manner, the merging module 14 is specifically configured to:

[0167] According to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, wherein the file size of each sub-file in the first file is greater than or equal to a first threshold;

[0168] According to the number of subordinate sub-files corresponding to each sub-file in the first file, the sub-files in the first file are merged to obtain a second file;

[0169] The file level of each sub-file in the second file is set to level one to obtain the target file.

[0170] In a possible implementation manner, the merging module 14 is specifically configured to:

[0171] According to the file directory and the file size of each sub-file in the initial file, performing a first merging process on the sub-files in the initial file to obtain a first intermediate file;

[0172] According to the file directory and the file size of each sub-file in the i-th intermediate file, performing an i+1th merging process on the sub-files in the i-th intermediate file to obtain an i+1th intermediate file;

[0173] Among them, the i is 1, 2, 3... in sequence, until the file sizes of each leaf file in the Mth intermediate file are respectively greater than or equal to the first threshold, the Mth intermediate file is determined as the first file, and M is an integer greater than or equal to 1.

[0174] In a possible implementation manner, the merging module 14 is specifically configured to:

[0175] According to the file directory, a plurality of leaf files are determined in each subfile of the initial file, wherein the leaf files do not have a next-level file;

[0176] Determine a target leaf file from the plurality of leaf files according to the file size of each leaf file, wherein the file size of the target leaf file is smaller than the first threshold;

[0177] The target leaf file is merged into the parent file of the target leaf file to obtain the first intermediate file, and the target leaf file is the next level file of the parent file.

[0178] In a possible implementation manner, the merging module 14 is specifically configured to:

[0179] Determine a target subfile in the subfiles of the first file according to the number of subordinate subfiles corresponding to each subfile, wherein the number of subordinate subfiles corresponding to the target subfile is less than a second threshold;

[0180] A target parent file of the target child file is determined, and the target child file and subordinate child files of the target child file are merged into the target parent file to obtain the second file.

[0181] In a possible implementation manner, the backup module 15 is specifically used for:

[0182] Read each sub-file in the target file;

[0183] Each sub-file in the target file is stored in a preset database to implement file backup processing for the target file.

[0184] A data backup device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0185] Fig.12 A schematic diagram of another data backup device provided in an embodiment of the present application, in Fig.11 Based on the examples shown, see Fig.12 The device further comprises: a first acquisition module 16, a second acquisition module 17, and a splitting module 18, wherein:

[0186] The first acquisition module 16 is used to obtain a recovery request corresponding to the initial file;

[0187] The second acquisition module 17 is used to acquire the target file from a preset database according to the restoration request;

[0188] The splitting module 18 is used to split the sub-files of the target file according to the file directory to obtain the initial file.

[0189] A data backup device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0190] Fig.13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.12 As shown, the electronic device 20 may include: a transceiver 21 , a processor 22 , and a memory 23 .

[0191] The processor 22 executes the computer execution instructions stored in the memory, so that the processor 22 executes the scheme in the above embodiment. The processor 22 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0192] The memory 23 is connected to the processor 22 via a system bus and completes communication between them. The memory 23 is used to store computer program instructions.

[0193] The transceiver 21 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.

[0194] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0195] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.

[0196] An embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the data backup method in the above embodiment.

[0197] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the data backup method in the above embodiment.

[0198] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the data backup method in the above embodiment can be implemented.

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

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

[0201] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0202] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0203] It should be understood that the above processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.

[0204] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0205] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0206] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0207] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0208] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0209] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data backup method, characterized in that: include: Determine an initial file to be backed up and a file directory of the initial file, wherein the initial file includes a plurality of sub-files, and the file levels of the plurality of sub-files are greater than or equal to 1; Determine the file size of each sub-file in the initial file; According to the file directory, determine the number of subordinate sub-files corresponding to each sub-file; According to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file, the sub-files in the initial file are merged to obtain a target file, wherein the target file includes a plurality of first-level sub-files; Perform file backup processing on the target file.

2. The method according to claim 1, characterized in that According to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file, the sub-files in the initial file are merged to obtain a target file, including: According to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, wherein the file size of each sub-file in the first file is greater than or equal to a first threshold; According to the number of subordinate sub-files corresponding to each sub-file in the first file, the sub-files in the first file are merged to obtain a second file; The file level of each sub-file in the second file is set to level one, to obtain the target file.

3. The method according to claim 2, characterized in that According to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are merged to obtain a first file, including: According to the file directory and the file size of each sub-file in the initial file, performing a first merging process on the sub-files in the initial file to obtain a first intermediate file; According to the file directory and the file size of each sub-file in the i-th intermediate file, performing an i+1th merging process on the sub-files in the i-th intermediate file to obtain an i+1th intermediate file; Among them, the i is 1, 2, 3... in sequence, until the file sizes of each leaf file in the Mth intermediate file are respectively greater than or equal to the first threshold, the Mth intermediate file is determined as the first file, and M is an integer greater than or equal to 1.

4. The method according to claim 3, characterized in that According to the file directory and the file size of each sub-file in the initial file, the sub-files in the initial file are first merged to obtain a first intermediate file, including: According to the file directory, a plurality of leaf files are determined in each subfile of the initial file, wherein the leaf files do not have a next-level file; Determine a target leaf file from the plurality of leaf files according to the file size of each leaf file, wherein the file size of the target leaf file is smaller than the first threshold; The target leaf file is merged into the parent file of the target leaf file to obtain the first intermediate file, and the target leaf file is the next level file of the parent file.

5. The method according to any one of claims 2 to 4, characterized in that: According to the number of subordinate sub-files corresponding to each sub-file in the first file, the sub-files in the first file are merged to obtain a second file, including: Determine a target subfile in the subfiles of the first file according to the number of subordinate subfiles corresponding to each subfile, wherein the number of subordinate subfiles corresponding to the target subfile is less than a second threshold; A target parent file of the target child file is determined, and the target child file and subordinate child files of the target child file are merged into the target parent file to obtain the second file.

6. The method according to any one of claims 1 to 5, characterized in that: Performing file backup processing on the target file includes: Read each sub-file in the target file; Each sub-file in the target file is stored in a preset database to implement file backup processing for the target file.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtaining a recovery request corresponding to the initial file; According to the restoration request, obtaining the target file in a preset database; According to the file directory, the sub-files of the target file are split and processed to obtain the initial file.

8. A data backup device, characterized in that: include: A first determining module, a second determining module, a third determining module, a merging module and a backup module, wherein: The first determination module is used to determine an initial file to be backed up and a file directory of the initial file, wherein the initial file includes a plurality of sub-files, and the file levels of the plurality of sub-files are greater than or equal to 1; The second determining module is used to determine the file size of each sub-file in the initial file; The third determination module is used to determine the number of subordinate sub-files corresponding to each sub-file according to the file directory; The merging module is used to merge the sub-files in the initial file according to the file directory, the file size of each sub-file in the initial file, and the number of subordinate sub-files corresponding to each sub-file to obtain a target file; The backup module is used to perform file backup processing on the target file.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.