A file system ultra-long path intelligent storage method and device
By segmenting and labeling ultra-long paths and establishing a mapping table, the problem of path length limitation is solved and the storage of ultra-long paths and user experience improvement are achieved.
Patent Information
- Application Number
- CN202110189781.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-18
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-02-18
AI Technical Summary
Existing technology cannot effectively store ultra-long paths because the operating system limits the path length and cannot store ultra-long paths.
By obtaining the length of the path to be processed, determining whether it exceeds the threshold, dividing the path into multiple path segments, using keywords or keyword extraction algorithms to extract tags, and establishing a mapping table between tags and path segments, storing the compressed tags, and implementing the path of smart storage.
It realizes the storage of ultra-long paths, avoids path length restrictions, and improves the storage capacity and user experience of the file system.
Smart Images

Figure CN112925755B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of file management, and in particular to a method and device for intelligently storing ultra-long paths of a file system. Background Art
[0002] With the development of information technology, the government is increasingly transferring government services to the Internet. In order to facilitate public access, when building an information platform, it is necessary to classify relevant files and display them in the form of a directory tree. Usually, it is necessary to establish a directory tree in order according to region, department, year, month, file subject, file content summary, etc. In addition, in order to facilitate file retrieval, the name of the file or folder is named after the abstract. For documents with more complex content, the corresponding abstract will be longer, and some abstracts may be hundreds of words, which is relatively long. In the actual log system, if the logs generated by different users accessing the region, department, year, month, file subject, and file content in different time periods are stored in different folders, the depth of the generated directory tree may be deeper.
[0003] In order to store the above files, after the operating system enables Win32 long paths, listed win32 applications and Windows Store applications can access paths that exceed the limit on file systems that support the standard limit of 260 characters per node. Enabling this setting will result in access to long paths in the process. However, even if Windows NTFS with long paths is enabled, it can only support path names with a total length of up to 32768 characters. If the path length exceeds the limit of 32768, the system still cannot achieve storage. In other words, there is still a technical problem in the prior art that ultra-long paths cannot be stored. Summary of the invention
[0004] The technical problem to be solved by the present invention is how to store an extremely long path.
[0005] The present invention solves the above technical problems through the following technical means:
[0006] The present invention provides a method for intelligently storing ultra-long paths of a file system, the method comprising:
[0007] Obtaining the length of the path to be processed, and determining whether the length of the path to be processed is greater than a first preset threshold;
[0008] If yes, divide the path to be processed into several path segments according to the path section separator, obtain the mark of the path segment, use the mark to replace the corresponding path segment, obtain the target path and store it;
[0009] The corresponding path segment is stored in the document, and a mapping table is established between the tag and the path segment.
[0010] Optionally, obtaining the tag of the path segment includes:
[0011] For the path segment, a keyword extraction algorithm is used to extract the keyword of the path segment, and the keyword is used as a tag.
[0012] Optionally, obtaining the tag of the path segment includes:
[0013] Determine whether the character length corresponding to the path segment exceeds a second preset threshold;
[0014] If so, a keyword extraction algorithm is used to extract the keyword of the path segment, and the keyword is used as a tag.
[0015] Optionally, obtaining the tag of the path segment includes:
[0016] Extracting keywords from the current path segment using a keyword extraction algorithm, or extracting keywords from the names of folders and / or files in the directory tree at the level corresponding to the current path segment using a keyword extraction algorithm, or extracting keywords from all files in the directory tree at the level corresponding to the current path segment using a keyword extraction algorithm;
[0017] Sorting the keywords according to their frequency to obtain a first frequency sequence, and selecting keywords corresponding to a set number of sequential orders from the first frequency sequence as tags;
[0018] Optionally, selecting a set number of keywords corresponding to a sequential order from the first word frequency sequence as tags includes:
[0019] When obtaining the first word frequency sequence corresponding to the current path segment, keywords that have appeared in the path segment before the current path segment are removed from the first word frequency sequence to obtain a second word frequency sequence;
[0020] A set number of keywords corresponding to a sequential order are selected from the second word frequency sequence as tags.
[0021] Optionally, the method further includes:
[0022] Get the current path corresponding to the folder displayed to the user, and determine whether the last path segment in the current path is a marker;
[0023] If so, the corresponding target content is found out according to the mark and a pre-established mapping table, and the target content is displayed to replace the last path segment.
[0024] Optionally, after displaying the target content instead of the last path segment, the method further includes:
[0025] When the user opens the lower-level folder of the path where the target content is located, the target content display is replaced with the last path segment.
[0026] The present invention also provides a file system ultra-long path intelligent storage device, the device comprising:
[0027] A judging module, used for obtaining the length of the path to be processed, and judging whether the length of the path to be processed is greater than a first preset threshold;
[0028] an acquisition module, configured to divide the path to be processed into a plurality of path segments according to the path section separators, acquire the marks of the path segments, replace the corresponding path segments with the marks, obtain the target path and store it, if the judgment result of the judgment module is yes;
[0029] A module is established to store the corresponding path segment in the document and to establish a mapping table between the tag and the path segment.
[0030] Optionally, get the module to:
[0031] For the path segment, a keyword extraction algorithm is used to extract the keyword of the path segment, and the keyword is used as a tag.
[0032] Optionally, get the module to:
[0033] Determine whether the character length corresponding to the path segment exceeds a second preset threshold;
[0034] If so, a keyword extraction algorithm is used to extract the keyword of the path segment, and the keyword is used as a tag.
[0035] Optionally, the device further includes: a first replacement module, configured to:
[0036] Get the current path corresponding to the folder displayed to the user, and determine whether the last path segment in the current path is a marker;
[0037] If so, the corresponding target content is found out according to the mark and a pre-established mapping table, and the target content is displayed to replace the last path segment.
[0038] Optionally, a second replacement module is used to:
[0039] When the user opens the lower-level folder of the path where the target content is located, the target content display is replaced with the last path segment.
[0040] The advantages of the present invention are:
[0041] By applying the embodiment of the present invention, the path segments of the super-long path to be processed are compressed to obtain compressed marks, the path segments are stored in a file, and a mapping relationship between the marks and the path segments is established. Since the number of characters stored in the file is much larger than 32768 and there is no limit on the number of characters, super-long paths can be stored. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of a process flow of a file system ultra-long path intelligent storage method provided by an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of the structure of an ultra-long path intelligent storage device for a file system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] Example 1
[0046] Figure 1 A flowchart of a method for intelligently storing ultra-long paths in a file system provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, an embodiment of the present invention provides a method for intelligent storage of ultra-long paths of a file system, the method comprising:
[0047] S101: Obtain the length of the path to be processed, and determine whether the length of the path to be processed is greater than a first preset threshold. If so, execute S102; if not, end the loop.
[0048] Exemplary:
[0049] The following embodiment of the present invention is described by taking an extremely long path to be processed as an example:
[0050] The obtained path to be processed is:
[0051] C:\path segment-1\path segment-2\path segment-3\path segment-4\path segment-5\path segment-6.
[0052] Since the path is too long, for the convenience of description, each path segment is numbered. Since the total length of the path to be processed has exceeded the first preset threshold, such as 26,000 characters, step S102 is executed. Further, the first preset threshold can be set to 32,768; then when the path to be processed is generated using software or manually, when the total number of characters in the generated path reaches 32,678, the path segment input by the user at the current moment can be processed according to the embodiment of the present invention; the path segment that has been input can also be processed according to the embodiment of the present invention.
[0053] It should be emphasized that, in the embodiment of the present invention, the value of the first preset threshold is generally 80% of 32768; the purpose is to leave a certain space for adding a new path segment after the path to be processed, so as to improve the scalability of the system.
[0054] It should be emphasized that when the user opens the folder where the target file is located, the file storage path displayed to the user by the system only reaches the folder where the file is stored. However, for each file in the folder, the corresponding path to be processed should also include the file name of the file. In other words, the last path segment of the path to be processed described in the embodiment of the present invention, i.e., path segment -6, is the name of the file.
[0055] S102: Divide the path to be processed into a plurality of path segments according to the path section separators, obtain the marks of the path segments, use the marks to replace the corresponding path segments, obtain the target path and store it.
[0056] In the first specific implementation of the embodiment of the present invention, path segment-2 is taken as an example for description.
[0057] In actual applications, users usually search through folders layer by layer to find the corresponding files. After finding the suspected folders, they click to open the files in the folders one by one to find them. If there are many pictures in the folder, or the amount of picture data is large, or the number of file pages is large, the user will open the file slowly to check whether the file is the target file he wants to find; further, if the file contains a lot of content, it is difficult for the user to browse, so the existing file search method is time-consuming. In order to avoid the time waste caused by users frequently opening files, it is convenient for users to view and retrieve various folders; in an embodiment of the present invention, each file is placed in the file name in a summary manner or in a key content excerpt manner, that is, the content of path segment-2 is formed; at the same time, the folder is named according to the summary or key content of the files and / or the subordinate folders contained in the folder, thereby forming a huge file storage tree with dozens or even hundreds of levels, and multiple contents similar to path segment-2 are spliced according to the directory level, thereby obtaining the path to be processed. This may cause the total number of characters in the file name plus the file storage path to exceed the upper limit set by the system.
[0058] In order to solve the above problem, in the embodiment of the present invention, a second preset threshold character length is preset for each path segment, for example, 500 characters. When the number of characters in path segment-2 exceeds 500 characters, a keyword extraction algorithm is used to extract the keywords of path segment-2. The keywords can be words that appear frequently in the document. These keywords can correspond to the summary of the document and the excerpt of the end point content in the document. These keywords are used as tags, and then the content of path segment-2 is stored in a txt document, and step S103 is performed to establish a mapping table between the content of path segment-2 and the tags in the txt document.
[0059] In a second specific implementation of the embodiment of the present invention, in order to save the length of the target path, in the process of extracting keywords, the following processing is performed for each current path segment in order from front to back:
[0060] The keyword extraction algorithm is used to extract the keywords in the current path segment, or the keyword extraction algorithm is used to extract the keywords in the names of the folders and / or files in the directory tree of the level corresponding to the current path segment, or the keyword extraction algorithm is used to extract the keywords of all the files in the directory tree of the level corresponding to the current path segment. The keywords are sorted according to their frequency to obtain a first frequency sequence, and keywords corresponding to a set number of sequential orders are selected from the first frequency sequence as tags; then each path segment is processed according to the above method to obtain tags corresponding to each path segment.
[0061] For example, when generating keywords for path segment-2, the keywords obtained are A, B, C, and D, and then the keywords are sorted according to the frequency, for example, the sorting result is BDCA; when the set number value is 2, keywords B and D are used as markers for path segment-2.
[0062] Furthermore, when obtaining the first word frequency sequence corresponding to the current path segment, the keywords that have appeared in the path segment before the current path segment are removed from the first word frequency sequence to obtain a second word frequency sequence, and then a set number of keywords corresponding to the sequential order are selected from the second word frequency sequence as markers.
[0063] For example, when generating keywords for the next path segment of path segment-2, such as path segment-3, path segment-2 is used as the previous path segment of path segment-3. The first word frequency sequence generated for path segment-3 is ADESG; since keyword D has already appeared in the first word frequency sequence corresponding to path segment-2, keyword D is extracted from the first word frequency sequence corresponding to path segment-3, and the second word frequency sequence obtained is AESG. Then the first two keywords A and E in the second word frequency sequence are used as markers for path segment-3. In actual applications, when counting the word frequency of path segment-2, the word frequency contained in all folders and files under the directory of path segment-2 should be counted, rather than just considering the word frequency data of the keywords contained in the files or folders contained in one of the subordinate path segments, that is, path segment-3.
[0064] By applying the embodiment of the present invention, when extracting keywords of the path to be processed, a certain keyword has already appeared in the path segment of the previous level of the path, so as to avoid the same keyword appearing in the header of each path segment, making it more convenient for users to view and improving the user experience.
[0065] Furthermore, in order to avoid keyword duplication while highlighting the key content in the next path segment, when obtaining the first word frequency sequence corresponding to the current path segment, the keywords that have appeared in the path segment before the current path segment and have a word frequency value lower than the third preset threshold are removed from the first word frequency sequence to obtain a second word frequency sequence, and then a set number of keywords corresponding to the sequential order are selected from the second word frequency sequence as markers.
[0066] For example, when the first word frequency sequence generated for path segment-3 is ADEBSG, since keywords D and B have already appeared in the tag of path segment-2, before removing DB from the first word frequency sequence of path segment-3, for each of keywords D and B, determine whether the word frequency value of the keyword is greater than a third preset threshold, such as 15. If the word frequency value of keyword D is greater than or equal to 15, and the word frequency value of keyword B is less than 15, keyword D is retained in the first word frequency sequence of path segment-3; keyword B is deleted from the first word frequency sequence of path segment-3. Furthermore, the second word frequency sequence corresponding to path segment-3 is ADESG, and then, according to the above method, keywords corresponding to a set number of sequential orders are screened out from the second word frequency sequence as the tag of path segment-3.
[0067] Furthermore, in order to dynamically adjust the total number of characters corresponding to the set number of keywords, that is, the size of the second preset threshold, the formula can be used: Calculate the total number of characters corresponding to a set number of keywords, where:
[0068] k is the value of the set number; m is the sum of the number of characters in the path segment before the current path segment; M is the number of keywords in the path to be processed whose word frequency value is greater than the fourth preset threshold; L1 is the path depth of the current path segment; L2 is the maximum depth of the path to be processed where the current path segment is located; a is a pre-set adjustment coefficient, and its specific value can be a positive integer greater than or equal to 20 and less than 1000. The principle of its value selection is generally that the more keywords that appear repeatedly in all path segments between the current path segment, the larger the value.
[0069] In a third specific implementation of the embodiment of the present invention, in order to further compress the length of the path to be processed, a hash algorithm or an MD5 algorithm may be used to process the path segment-2, and the processed characters may be used as tags, and a corresponding mapping table may be established.
[0070] Furthermore, in order to further compress the length of the path to be processed, all path segments may be processed according to the above method.
[0071] S103: Store the corresponding path segment in the document, and create a mapping table between the tag and the path segment.
[0072] Exemplarily, a mapping relationship between a current path segment and a corresponding tag is established, and then a mapping table is established according to the mapping relationships of a plurality of path segments.
[0073] By applying the embodiments of the present invention, when a user or system generates a path to be processed, the user or system only needs to consider which paragraphs or contents they need to put in the path to be processed, without considering whether the total number of characters in the path to be processed exceeds a first preset threshold. The system automatically adjusts the total number of characters in the path to be processed, thereby improving the user experience.
[0074] Example 2
[0075] On the basis of Example 1 of the present invention, Example 2 of the present invention further adds the following steps:
[0076] S104 (not shown in the figure): obtain the current path corresponding to the folder displayed to the user, and determine whether the last path segment in the current path is a mark. If so, execute S105.
[0077] For example, the path corresponding to the folder opened by the user is:
[0078] C:\mark-1\mark-2\mark-3\mark-4. Then, the last path segment in the current path is mark-4.
[0079] When the user opens the folder, the system hides the contents of "C:\Mark-1\Mark-2\Mark-3\" by default and only shows the location of "Mark-4" to the user; determine whether the content of "Mark-4" is a mark, and if so, execute S105.
[0080] S105 (not shown in the figure): query the corresponding target content according to the mark and the pre-established mapping table, and replace the last path segment with the target content for display.
[0081] When "Tag-4" is a tag, the corresponding target content is queried from the mapping table, and the content of the target content is displayed at the position of "Tag-4".
[0082] Furthermore, after the target content is displayed to the user, if the target content is large and cannot be fully displayed in one line of the address bar, in order to improve the user experience, when the user moves the mouse to the address bar, the address bar pulls down to form multiple lines, and then displays the target content in separate lines.
[0083] Alternatively, when the user moves the mouse to the mark of the corresponding file or folder, the system pops up a window and displays the target content of mark-4 corresponding to the mark in the window.
[0084] By applying the above-mentioned embodiments of the present invention, the original content before the corresponding keyword is extracted, that is, the target content, can be restored from the mark.
[0085] Furthermore, after the user opens the lower folder of the path where the target content is located, the target content display is replaced by the end mark and is hidden to make room for the next path segment mark -5 of mark -4.
[0086] Example 3
[0087] Corresponding to the first embodiment of the present invention, the second embodiment further provides an ultra-long path intelligent storage device for a file system.
[0088] Figure 2 A structural diagram of a file system ultra-long path intelligent storage device provided by an embodiment of the present invention, such as Figure 2 As shown, the device comprises:
[0089] The judging module 201 is used to obtain the length of the path to be processed and judge whether the length of the path to be processed is greater than a first preset threshold;
[0090] The acquisition module 202 is used for dividing the path to be processed into a plurality of path segments according to the path section break, acquiring the mark of the path segment, replacing the corresponding path segment with the mark, obtaining the target path and storing it if the judgment result of the judgment module is yes;
[0091] The establishing module 203 is used to store the corresponding path segment in the document and establish a mapping table between the tag and the path segment.
[0092] In a specific implementation of the embodiment of the present invention, the acquisition module 202 is used to:
[0093] For the path segment, a keyword extraction algorithm is used to extract the keyword of the path segment, and the keyword is used as a tag.
[0094] In a specific implementation of the embodiment of the present invention, the acquisition module 202 is used to:
[0095] Determine whether the character length corresponding to the path segment exceeds a second preset threshold;
[0096] If so, a keyword extraction algorithm is used to extract the keyword of the path segment, and the keyword is used as a tag.
[0097] In a specific implementation of the embodiment of the present invention, the first replacement module 204 (not shown in the figure) is used to:
[0098] Get the current path corresponding to the folder displayed to the user, and determine whether the last path segment in the current path is a marker;
[0099] If so, the corresponding target content is found out according to the mark and a pre-established mapping table, and the target content is displayed to replace the last path segment.
[0100] In a specific implementation of the embodiment of the present invention, the first replacement module 205 (not shown in the figure) is used to: when the user opens the lower folder of the path where the target content is located, use the last path segment to replace the target content display.
[0101] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for intelligent storage of ultra-long paths in a file system, characterized in that: The method comprises: Obtaining the length of the path to be processed, and determining whether the length of the path to be processed is greater than a first preset threshold; If yes, divide the path to be processed into several path segments according to the path section separator, obtain the mark of the path segment, use the mark to replace the corresponding path segment, obtain the target path and store it; The corresponding path segment is stored in the document, and a mapping table is established between the tag and the path segment; Wherein, the obtaining of the tag of the path segment includes: extracting the keywords in the current path segment by using a keyword extraction algorithm, or extracting the keywords in the names of each folder and / or file in the directory tree corresponding to the current path segment by using a keyword extraction algorithm, or extracting the keywords of all files in the directory tree corresponding to the current path segment by using a keyword extraction algorithm; sorting the keywords according to their word frequencies to obtain a first word frequency sequence, and selecting a set number of keywords corresponding to a sequential order from the first word frequency sequence as tags; The method of selecting a set number of keywords corresponding to a sequential order from the first word frequency sequence as tags includes: when obtaining the first word frequency sequence corresponding to the current path segment, removing the keywords that have appeared in the path segment before the current path segment from the first word frequency sequence to obtain a second word frequency sequence; and selecting a set number of keywords corresponding to a sequential order from the second word frequency sequence as tags.
2. The method for intelligent storage of ultra-long paths of a file system according to claim 1, characterized in that: The method further comprises: Get the current path corresponding to the folder displayed to the user, and determine whether the last path segment in the current path is a marker; If so, the corresponding target content is found out according to the mark and a pre-established mapping table, and the target content is displayed to replace the last path segment.
3. The method for intelligent storage of ultra-long paths of a file system according to claim 2, characterized in that: After displaying the target content instead of the last path segment, the method further includes: When the user opens the lower-level folder of the path where the target content is located, the target content display is replaced with the last path segment.
4. A file system ultra-long path intelligent storage device, characterized in that: The device comprises: A judging module, used for obtaining the length of the path to be processed, and judging whether the length of the path to be processed is greater than a first preset threshold; an acquisition module, configured to divide the path to be processed into a plurality of path segments according to the path section separators, acquire the marks of the path segments, replace the corresponding path segments with the marks, obtain the target path and store it, if the judgment result of the judgment module is yes; Establishing a module for storing the corresponding path segment in the document and establishing a mapping table between the tag and the path segment; The acquisition module acquires the short path mark by: extracting keywords in the current path segment by using a keyword extraction algorithm, or extracting keywords in the names of folders and / or files in the directory tree corresponding to the current path segment by using a keyword extraction algorithm, or extracting keywords of all files in the directory tree corresponding to the current path segment by using a keyword extraction algorithm; sorting the keywords according to their word frequencies to obtain a first word frequency sequence, and selecting keywords corresponding to a set number of sequential orders from the first word frequency sequence as marks; The method of selecting a set number of keywords corresponding to a sequential order from the first word frequency sequence as tags includes: when obtaining the first word frequency sequence corresponding to the current path segment, removing the keywords that have appeared in the path segment before the current path segment from the first word frequency sequence to obtain a second word frequency sequence; and selecting a set number of keywords corresponding to a sequential order from the second word frequency sequence as tags.
