File processing method and device, storage medium and computer program product
By obtaining the MD5 value and file storage level of the file to be stored, determining its target storage directory and determining whether there are historical files, the problem of duplicate storage in the prior art is solved, and a more efficient storage utilization rate is achieved.
Patent Information
- Application Number
- CN202411900738.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the data storage system stores multiple identical files on the hard disk when the same file is operated at different times or through different channels in a way that stores files by time, reducing the usage rate of the hard disk and causing waste of storage resources.
By obtaining the MD5 value and file storage level of the file to be stored, determine its target storage directory, and determine whether there is a historical file corresponding to the MD5 value in this directory. If present, the storage of the files to be stored is completed based on the file name or number of bytes of the historical file to avoid repeated storage of the files.
It effectively avoids duplicate storage of files, prevents missed storage, missed storage and loss of files, saves storage space in the storage system, and improves the utilization rate of the storage system.
Smart Images

Figure CN119861869A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of file storage technology, and specifically to a file processing method, device, storage medium and computer program product. Background Art
[0002] Data is a core product of an enterprise and a country, and data leakage can cause serious losses. With the rapid development of society, data has increased rapidly, and various data need to be stored. In order to prevent data leakage, that is, to enhance the understanding of data, compare the time, person, channel, and file sent to which person, the data storage system will record each file passing through the system. The current data storage system generally stores files by time. Therefore, the same file at different times or through different channels will store multiple copies of the same file on the hard disk, reducing the utilization rate of the hard disk and causing a waste of storage resources. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a file processing method, device, storage medium and computer program product to solve the problems of waste of storage resources and low storage space utilization in the prior art.
[0004] In order to achieve the above-mentioned object, the first aspect of the present application provides a file processing method, the method comprising:
[0005] Get the file to be stored and its MD5 value;
[0006] Determine the file storage level of the file to be stored;
[0007] Determine the target storage directory for the file to be stored based on the MD5 value and the file storage level;
[0008] If the target storage directory exists in the storage system, determine whether there is a historical file corresponding to the MD5 value in the target folder under the target storage directory;
[0009] If there is a history file corresponding to the MD5 value in the target folder, obtain the file name or byte number of the history file;
[0010] The storage of the file to be stored is completed according to the file name or byte number of the historical file.
[0011] In an embodiment of the present application, completing the storage of the file to be stored according to the file name or byte number of the historical file includes: judging whether the size of the historical file is consistent with the file to be stored according to the byte number of the historical file and the byte number of the file to be stored; if the size of the historical file is inconsistent with the file to be stored, storing the file to be stored in the target folder; or judging whether the file name of the historical file is consistent with the file name of the file to be stored; if the file name of the historical file is inconsistent with the file name of the file to be stored, adding the file name of the file to be stored to the file name of the historical file to complete the storage of the file to be stored; if the file name of the historical file is consistent with the file name of the file to be stored, adding a numerical value representing the number of times the file name of the historical file appears after the file name of the historical file to complete the storage of the file to be stored.
[0012] In an embodiment of the present application, the method also includes: if the target storage directory does not exist in the storage system, creating a target storage directory and a target folder under the target storage directory for storing the files to be stored; and storing the files to be stored in the created target folder.
[0013] In the embodiment of the present application, the method further includes: if there is no historical file corresponding to the MD5 value in the target folder, storing the file to be stored in the target folder.
[0014] In an embodiment of the present application, determining the file storage level of the file to be stored includes: obtaining the capacity and number of nodes of the storage system; and determining the file storage level according to the capacity and the number of nodes.
[0015] In an embodiment of the present application, determining the file storage level of the file to be stored includes: obtaining the file storage level for the file to be stored input by a user.
[0016] In an embodiment of the present application, the method further includes: reading the file names of all stored files and the number of file names of all stored files corresponding to the MD5 values from the storage system, and visualizing them.
[0017] A second aspect of the present application provides a file processing device, comprising:
[0018] a memory configured to store instructions;
[0019] The processor is configured to call instructions from the memory and implement the above-mentioned file processing method when executing the instructions.
[0020] A third aspect of the present application provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned file processing method.
[0021] A fourth aspect of the present application provides a computer program product, including a computer program, which implements the above-mentioned file processing method when executed by a processor.
[0022] Through the above technical scheme, the files to be stored and the MD5 values of the files to be stored are obtained; the file storage level of the files to be stored is determined; the target storage directory of the files to be stored is determined according to the MD5 value and the file storage level; when the target storage directory exists in the storage system, it is determined whether there is a historical file corresponding to the MD5 value in the target folder under the target storage directory; when the historical file corresponding to the MD5 value exists in the target folder, the file name or the number of bytes of the historical file is obtained; the storage of the files to be stored is completed according to the file name or the number of bytes of the historical file, which can prevent the omission and erroneous storage of files and prevent the loss of files on the basis of avoiding repeated storage of files, save the storage space of the storage system, and improve the utilization rate of the storage system.
[0023] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0025] Figure 1 A schematic diagram of a process flow of a file processing method according to an embodiment of the present application is schematically shown;
[0026] Figure 2 The internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0028] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0029] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0030] Figure 1 The following schematically shows a flow chart of a file processing method according to an embodiment of the present application. Figure 1 As shown, an embodiment of the present application provides a file processing method, which may include the following steps.
[0031] Step 101: Obtain the file to be stored and the MD5 value of the file to be stored.
[0032] Step 102: Determine the file storage level of the file to be stored.
[0033] MD5 value (Message Digest Algorithm MD5) is a widely used cryptographic hash function that can generate a 128-bit (16-byte) hash value to ensure the integrity and consistency of information transmission. The processor can obtain the MD5 value of the file to be stored and the file to be stored. And determine the file storage level of the file to be stored.
[0034] In an embodiment of the present application, determining the file storage level of the file to be stored includes: obtaining the capacity and number of nodes of the storage system; and determining the file storage level according to the capacity and the number of nodes.
[0035] The processor may determine the file storage level of the file to be stored. Specifically, the processor may obtain the capacity and number of nodes of the storage system. After obtaining the capacity and number of nodes of the storage system, the processor may determine the file storage level according to the capacity and number of nodes.
[0036] In an embodiment of the present application, determining the file storage level of the file to be stored includes: obtaining the file storage level for the file to be stored input by a user.
[0037] The processor may determine the file storage level of the file to be stored. Specifically, the processor may obtain the file storage level for the file to be stored input by the user.
[0038] Step 103: Determine the target storage directory for the file to be stored according to the MD5 value and the file storage level.
[0039] Step 104: When the target storage directory exists in the storage system, determine whether there is a historical file corresponding to the MD5 value in the target folder under the target storage directory.
[0040] After obtaining the MD5 value and the file storage level of the file to be stored, the processor may determine the target storage directory of the file to be stored according to the MD5 value and the file storage level. After obtaining the target storage directory, the processor may determine whether the target storage directory is stored in the storage system. The storage system may be a disk. If the target storage directory exists in the storage system, the processor may determine whether there is a historical file corresponding to the MD5 value in the target folder under the target storage directory.
[0041] In an embodiment of the present application, the method also includes: if the target storage directory does not exist in the storage system, creating a target storage directory and a target folder under the target storage directory for storing the files to be stored; and storing the files to be stored in the created target folder.
[0042] In the case that the target storage directory does not exist in the storage system, the processor may create the target storage directory and a target folder under the target storage directory for storing the files to be stored. After creating the target folder, the processor may store the files to be stored in the created target folder.
[0043] Step 105: If there is a history file corresponding to the MD5 value in the target folder, obtain the file name or byte number of the history file.
[0044] In the case that a history file corresponding to the MD5 value exists in the target folder, the processor may obtain the file name or the number of bytes of the history file.
[0045] In the embodiment of the present application, the method further includes: if there is no historical file corresponding to the MD5 value in the target folder, storing the file to be stored in the target folder.
[0046] In the case that there is no historical file corresponding to the MD5 value in the target folder, the processor may store the file to be stored in the target folder to implement storage of the file to be stored.
[0047] Step 106: Complete the storage of the file to be stored according to the file name or the number of bytes of the historical file.
[0048] After obtaining the file name or the number of bytes of the historical file, the processor may complete the storage of the file to be stored according to the file name or the number of bytes of the historical file.
[0049] In an embodiment of the present application, completing the storage of the file to be stored according to the file name or byte number of the historical file includes: judging whether the size of the historical file is consistent with the file to be stored according to the byte number of the historical file and the byte number of the file to be stored; if the size of the historical file is inconsistent with the file to be stored, storing the file to be stored in the target folder; or judging whether the file name of the historical file is consistent with the file name of the file to be stored; if the file name of the historical file is inconsistent with the file name of the file to be stored, adding the file name of the file to be stored to the file name of the historical file to complete the storage of the file to be stored; if the file name of the historical file is consistent with the file name of the file to be stored, adding a numerical value representing the number of times the file name of the historical file appears after the file name of the historical file to complete the storage of the file to be stored.
[0050] The processor can complete the storage of the file to be stored according to the file name or byte number of the historical file. Specifically, the processor can determine whether the size of the historical file is consistent with the size of the file to be stored according to the byte number of the historical file and the byte number of the file to be stored. In the case where the size of the historical file is inconsistent with the size of the file to be stored, the processor can store the file to be stored in the target folder.
[0051] Alternatively, the processor may determine whether the file name of the historical file is consistent with the file name of the file to be stored. If the file name of the historical file is inconsistent with the file name of the file to be stored, the processor may add the file name of the file to be stored to the file name of the historical file to complete the storage of the file to be stored.
[0052] When the file name of the historical file is consistent with the file name of the file to be stored, the processor may add a value representing the number of times the file name of the historical file appears after the file name of the historical file to complete the storage of the file to be stored.
[0053] In an embodiment of the present application, the method further includes: reading the file names of all stored files and the number of file names of all stored files corresponding to the MD5 values from the storage system, and visualizing them.
[0054] After completing the storage of the files to be stored, the processor may read the file names of all stored files and the number of file names of all stored files corresponding to the MD5 values from the storage system, and perform visualization.
[0055] In one embodiment, the MD5 value of the file to be stored obtained by the processor may be CD5F5C88F84A8A3B81D59D16C418A18C, and the file name of the file to be stored is "test file.docx". The processor determines that the file storage level of the file to be stored is three layers. The processor may determine the target storage directory of the file to be stored as "CD / 5F / 5C" based on the MD5 value and the file storage level. Specifically, the processor may determine the target storage directory name based on the MD5 value CD5F5C88F84A8A3B81D59D16C418A18C. Specifically, the processor may determine the first and second digits of the MD5 value as the first-level storage directory name, i.e., the first-level storage directory name "CD", the third and fourth digits of the MD5 value as the second-level storage directory name, i.e., the second-level storage directory name "5F", and the fifth and sixth digits of the MD5 value as the third-level storage directory name, i.e., the third-level storage directory name "5C". After obtaining the target storage directory of the file to be stored, the processor can determine whether the target storage directory "CD / 5F / 5C" exists in the disk. If the target storage directory "CD / 5F / 5C" does not exist in the disk, the processor can create the target storage directory "CD / 5F / 5C" in the magnet and create a JSON file under the target storage directory "CD / 5F / 5C", and the file name is CD5F5C.JSON. After creating the JSON file, the processor can write the file to be stored into CD5F5C.JSON, where the format of CD5F5C.JSON after storage can be {CD5F5C88F84A8A3B81D59D16C418A18C: test file.docx}.
[0056] When the target storage directory "CD / 5F / 5C" exists on the disk, the processor can determine whether the MD5 value of the JSON file already existing in the target storage directory "CD / 5F / 5C" is equal to the MD5 value of the file to be stored. When the MD5 value of the JSON file already existing in the target storage directory "CD / 5F / 5C" is not equal to the MD5 value of the file to be stored, the processor can create an empty JSON file in the target storage directory "CD / 5F / 5C" and store the file to be stored in the empty JSON file, wherein the MD5 value CD5F5C88F84A8A3B81D59D16C418A18C of the file to be stored is written into the key of the empty JSON file, and the file name "test file.docx" of the file to be stored is written into the value of the empty JSON file.
[0057] When the MD5 value of the existing JSON file under the target storage directory "CD / 5F / 5C" is equal to the MD5 value of the file to be stored, the processor can determine whether the file size of the existing JSON file with the same MD5 value is consistent with the file to be stored. For example, the processor can obtain the number of bytes of the existing JSON file with the same MD5 value, and determine whether the number of bytes of the existing JSON file with the same MD5 value is consistent with the number of bytes of the file to be stored. When the number of bytes of the existing JSON file with the same MD5 value is consistent with the number of bytes of the file to be stored, the processor will no longer write the file to be stored to the disk. When the number of bytes of the existing JSON file with the same MD5 value is inconsistent with the number of bytes of the file to be stored, the processor can write the file to be stored to the disk.
[0058] Alternatively, the processor can determine whether the file name of the file to be stored is consistent with the file name of an existing JSON file with an equal MD5 value. For example, the file name of the existing JSON file with an equal MD5 value is "test file 2.docx". Then it can be determined that the file name "test file 2.docx" of the existing JSON file with an equal MD5 value is inconsistent with the file name "test file .docx" of the file to be stored. The processor can add the file name "test file .docx" of the file to be stored in the vlaue of the existing JSON file {CD5F5C88F84A8A3B81D59D16C418A18C: test file 2.docx} with an equal MD5 value, that is, {CD5F5C88F84A8A3B81D59D16C418A18C: [test file .docx, test file 2.docx]} to complete the storage of the file to be stored.
[0059] For example, the file name of an existing JSON file with an equal MD5 value is "test file.docx". Then it can be determined that the file name of the existing JSON file with an equal MD5 value "test file.docx" is consistent with the file name of the file to be stored "test file.docx". The processor can add a new vlaue after the vlaue of the existing JSON file with an equal MD5 value {CD5F5C88F84A8A3B81D59D16C418A18C: test file.docx}, and the newly added vlaue is used to record the number of occurrences of the file name "test file.docx". The processor can determine that the newly added vlaue is 2, {CD5F5C88F84A8A3B81D59D16C418A18C: [test file.docx], [2]}, which represents that "test file.docx" appears twice to complete the storage of the file to be stored.
[0060] After completing the storage of the file to be stored, when reading the stored file, the processor can read according to the MD5 value. Specifically, the processor can read all file names corresponding to the MD5 value and the number of times the same file name appears.
[0061] In one embodiment, the processor can obtain the capacity and number of nodes of the disk (i.e., the storage system). For example, the size of the disk is 1T and the number of nodes is 6 million. The processor can determine the number of files that can be stored in each directory based on the number of nodes and the file storage level. Assuming that the file storage level entered by the user is 4 layers, and each directory stores a range of 10 to 100 files, the processor can determine that the number of files that can be stored is 6000000÷16 4 ≈92, that is, 92 files can be stored, which is in the range of 10 to 100 files stored in each directory.
[0062] Through the above technical solution, it is possible to prevent omission and erroneous storage of files and prevent file loss on the basis of avoiding duplicate storage of files, save storage space of the storage system, and improve the utilization rate of the storage system.
[0063] Figure 1 FIG. 1 is a flowchart of a file processing method in one embodiment. It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0064] The present application also provides a file processing device, including:
[0065] a memory configured to store instructions;
[0066] The processor is configured to call instructions from the memory and implement the above-mentioned file processing method when executing the instructions.
[0067] An embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned file processing method.
[0068] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned file processing method when executed by a processor.
[0069] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 2 As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected through a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store data such as the MD5 value of the file to be stored, the file storage level, the target storage directory, the file name or the number of bytes of the historical file. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a file processing method is implemented.
[0070] Those skilled in the art will understand that Figure 2 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0071] An embodiment of the present application provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining a file to be stored and an MD5 value of the file to be stored; determining a file storage level of the file to be stored; determining a target storage directory for the file to be stored based on the MD5 value and the file storage level; in a case where a target storage directory exists in the storage system, determining whether there is a historical file corresponding to the MD5 value in a target folder under the target storage directory; in a case where a historical file corresponding to the MD5 value exists in the target folder, obtaining a file name or the number of bytes of the historical file; and completing storage of the file to be stored based on the file name or the number of bytes of the historical file.
[0072] In one embodiment, completing the storage of the file to be stored according to the file name or byte number of the historical file includes: judging whether the size of the historical file is consistent with that of the file to be stored according to the byte number of the historical file and the byte number of the file to be stored; if the size of the historical file is inconsistent with that of the file to be stored, storing the file to be stored in the target folder; or judging whether the file name of the historical file is consistent with the file name of the file to be stored; if the file name of the historical file is inconsistent with the file name of the file to be stored, adding the file name of the file to be stored to the file name of the historical file to complete the storage of the file to be stored; if the file name of the historical file is consistent with the file name of the file to be stored, adding a numerical value representing the number of times the file name of the historical file appears after the file name of the historical file to complete the storage of the file to be stored.
[0073] In one embodiment, the method further includes: if the target storage directory does not exist in the storage system, creating a target storage directory and a target folder under the target storage directory for storing the files to be stored; and storing the files to be stored in the created target folder.
[0074] In one embodiment, the method further includes: if there is no historical file corresponding to the MD5 value in the target folder, storing the file to be stored in the target folder.
[0075] In one embodiment, determining the file storage level of the file to be stored includes: obtaining the capacity and the number of nodes of the storage system; and determining the file storage level according to the capacity and the number of nodes.
[0076] In one embodiment, determining the file storage level of the file to be stored includes: obtaining the file storage level for the file to be stored input by a user.
[0077] In one embodiment, the method further includes: reading the file names of all stored files corresponding to the MD5 values and the number of the file names of all stored files from the storage system, and visualizing them.
[0078] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the steps of the file processing method.
[0079] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0080] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0081] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0082] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0083] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0084] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0085] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0086] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0087] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A file processing method, characterized in that: The method comprises: Obtain a file to be stored and its MD5 value; Determine the file storage level of the file to be stored; Determine the target storage directory of the file to be stored according to the MD5 value and the file storage level; In the case where the target storage directory exists in the storage system, determining whether there is a historical file corresponding to the MD5 value in the target folder under the target storage directory; If there is a history file corresponding to the MD5 value in the target folder, obtaining the file name or the number of bytes of the history file; The storage of the file to be stored is completed according to the file name or the number of bytes of the historical file.
2. The file processing method according to claim 1, characterized in that: The storing of the to-be-stored file according to the file name or the number of bytes of the historical file comprises: Determining whether the sizes of the historical file and the file to be stored are consistent according to the number of bytes of the historical file and the number of bytes of the file to be stored; If the sizes of the historical file and the file to be stored are inconsistent, storing the file to be stored in the target folder; or Determine whether the file name of the historical file is consistent with the file name of the file to be stored; In the case where the file name of the historical file is inconsistent with the file name of the file to be stored, adding the file name of the file to be stored to the file name of the historical file to complete the storage of the file to be stored; When the file name of the historical file is consistent with the file name of the file to be stored, a value representing the number of times the file name of the historical file appears is added after the file name of the historical file to complete the storage of the file to be stored.
3. The file processing method according to claim 1, characterized in that: The method further comprises: If the target storage directory does not exist in the storage system, create the target storage directory and a target folder under the target storage directory for storing the file to be stored; The file to be stored is stored in the created target folder.
4. The file processing method according to claim 1, characterized in that: The method further comprises: When there is no historical file corresponding to the MD5 value in the target folder, the file to be stored is stored in the target folder.
5. The file processing method according to claim 1, characterized in that: Determining the file storage level of the file to be stored includes: Obtaining the capacity and number of nodes of the storage system; The file storage level is determined according to the capacity and the number of nodes.
6. The file processing method according to claim 1, characterized in that: Determining the file storage level of the file to be stored includes: A file storage level for the file to be stored input by a user is obtained.
7. The file processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: The file names of all stored files corresponding to the MD5 values and the number of the file names of all stored files are read from the storage system and visualized.
8. A file processing device, characterized in that: include: a memory configured to store instructions; A processor is configured to call the instructions from the memory and implement the file processing method according to any one of claims 1 to 7 when executing the instructions.
9. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions, which are used to enable a machine to execute the file processing method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the file processing method according to any one of claims 1 to 7.