File mounting method and device
Patent Information
- Application Number
- CN202111537633.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2041-12-15
AI Technical Summary
[0005]本发明提供一种文件挂载方法及装置,用以解决现有技术中资源管理器中文件的目录结构与应用系统中的树形模型结构不匹配的情况下,应用系统无法挂载到资源管理器中的文件,也无法对资源管理器中的文件进行处理的缺陷,实现提高文件挂载的可靠性
[0032]本发明提供的文件挂载方法及装置,通过根据目标文件夹的根目录下的一级子目录集合和应用系统的树形结构模板,自动生成目标文件夹的树形结构,以使在任何场景下,目标文件夹的树形结构均与应用系统的树形结构模板相匹配,并可将目标文件夹中的目标文件成功挂载到应用系统中,有效提高文件挂载的成功率和可靠性,进而减少挂载失败对目标文件的功能使用的影响。
Smart Images

Figure CN116263756B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer application technology, and in particular to a file mounting method and apparatus. Background Technology
[0002] With the development and advancement of computer technology, more and more data files are stored in file explorers. When a file is needed, it can be mounted into the context of the corresponding application system to process the file within the application system.
[0003] When mounting files from File Explorer to an application system, the directory structures of different files in File Explorer vary, while application systems typically only mount and display files using a fixed tree model structure.
[0004] Therefore, when the directory structure of files in the file explorer does not match the tree model structure in the application system, the application system cannot mount the files in the file explorer, and thus cannot process the files in the file explorer. Summary of the Invention
[0005] This invention provides a file mounting method and apparatus to address the shortcomings of existing technologies where the directory structure of files in the resource manager does not match the tree model structure in the application system, resulting in the application system being unable to mount files in the resource manager or process files in the resource manager, thereby improving the reliability of file mounting.
[0006] This invention provides a file mounting method, comprising:
[0007] Get the set of first-level subdirectories under the root directory of the target folder;
[0008] Based on the set of first-level subdirectories and the tree structure template of the application system, obtain the tree structure of the target folder;
[0009] Based on the tree structure, the target files in the target folder are mounted to the application system.
[0010] According to a file mounting method provided by the present invention, obtaining the tree structure of the target folder based on the set of first-level subdirectories and the tree structure template of the application system includes:
[0011] The target number of levels is determined based on the tree structure template of the application system;
[0012] Based on the set of first-level subdirectories and the target level, the target folder is recursively called to obtain the tree structure of the target folder.
[0013] According to a file mounting method provided by the present invention, the step of recursively calling the target folder based on the set of first-level subdirectories and the target hierarchical number to obtain the tree structure of the target folder includes:
[0014] The target subfolder is searched in the set of first-level subdirectories. If it is not found, it is written into the first-level node of the tree structure template according to the node parameters returned by the set of first-level subdirectories.
[0015] Continue searching for the target subfolder in the next level subdirectory set of the first-level subdirectory set. If it is not found, write it to the next level node of the first-level node of the tree structure template according to the node parameters returned by the next level subdirectory set, until the boundary conditions are met; wherein, the boundary conditions are determined according to the target level number.
[0016] If the target subfolder is found, the target file is searched within the target subfolder. Based on the node parameters returned by the target file, the file is written into the last level node of the tree structure template to obtain the tree structure of the target folder.
[0017] According to a file mounting method provided by the present invention, the node parameter nodes returned by the target file include the file name and the file access path.
[0018] According to a file mounting method provided by the present invention, the step of searching for the target file in the target subfolder includes:
[0019] Read the folder objects in the target subfolder level by level, and obtain the target file from the folder objects.
[0020] According to a file mounting method provided by the present invention, obtaining the target file from the folder object includes:
[0021] The target file is obtained from the folder object based on its extension.
[0022] According to a file mounting method provided by the present invention, obtaining the set of first-level subdirectories under the root directory of the target folder includes:
[0023] Match the directory structure of the target folder with the tree structure template in the application system;
[0024] If there is a mismatch, obtain the set of first-level subdirectories under the root directory of the target folder.
[0025] The present invention also provides a file mounting device, comprising:
[0026] The first acquisition module is used to acquire the set of first-level subdirectories under the root directory of the target folder;
[0027] The second acquisition module is used to acquire the tree structure of the target folder based on the set of first-level subdirectories and the tree structure template of the application system;
[0028] The mounting module is used to mount the target files in the target folder to the application system according to the tree structure.
[0029] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the file mounting methods described above.
[0030] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the file mounting methods described above.
[0031] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the file mounting methods described above.
[0032] The file mounting method and apparatus provided by this invention automatically generate a tree structure of the target folder based on the set of first-level subdirectories under the root directory of the target folder and the tree structure template of the application system. This ensures that the tree structure of the target folder matches the tree structure template of the application system in any scenario, and can successfully mount the target files in the target folder to the application system, effectively improving the success rate and reliability of file mounting, and thus reducing the impact of mounting failure on the functionality of the target files. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0034] Figure 1 This is one of the flowcharts illustrating the file mounting method provided by the present invention;
[0035] Figure 2 This is one of the schematic diagrams of the directory structure of the target folder in the file mounting method provided by the present invention;
[0036] Figure 3This is one of the structural diagrams of the tree structure template in the file mounting method provided by the present invention;
[0037] Figure 4 This is the second schematic diagram of the directory structure of the target folder in the file mounting method provided by the present invention;
[0038] Figure 5 This is one of the schematic diagrams of the tree structure of the target folder in the file mounting method provided by the present invention;
[0039] Figure 6 This is the second schematic diagram of the tree structure of the target folder in the file mounting method provided by the present invention;
[0040] Figure 7 This is a schematic diagram of the file mounting device provided by the present invention;
[0041] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0043] The following is combined with Figure 1 The file mounting method of the present invention is described, the method comprising:
[0044] Step 101: Obtain the set of first-level subdirectories under the root directory of the target folder;
[0045] The file mounting method in this embodiment can be used for file mounting in various fields, such as mounting pipeline defect video files to an application system, or mounting industrial equipment operation data to an application system. This embodiment does not specifically limit this.
[0046] The file mounting method in this embodiment can be applied to different systems or devices, such as actuators; the actuator can be a computer, a server, or the cloud, etc., and this embodiment does not specifically limit it.
[0047] The target folder is the folder where files are to be mounted. It can be a folder containing video files of pipeline defects, or a folder containing operational data of industrial equipment, etc. This embodiment does not specifically limit this.
[0048] The target folder is stored in a multi-level structure in File Explorer;
[0049] Optionally, if it is necessary to mount the target folder in the resource manager to the application system, first obtain the set of first-level subdirectories under the root directory of the target folder according to the target structure of the target folder; where the root directory is the top-level directory of the target folder.
[0050] like Figure 2 As shown, the target folder's target structure is arranged hierarchically, consisting of the project folder, road folder, pipeline folder, and pipeline defect video folder, etc.; among them, the first-level subdirectories under the root directory of the target folder are the subdirectories of all project folders.
[0051] Step 102: Obtain the tree structure of the target folder based on the set of first-level subdirectories and the tree structure template of the application system.
[0052] Optionally, based on the set of first-level sub-targets, hierarchical calls are made to each level of the target folder, and the node parameters of the tree structure are returned during the hierarchical call process. The node parameters are written into the tree structure template to obtain the tree structure of the target folder.
[0053] Since the tree structure of the target folder is obtained based on the tree structure template of the application system, the tree structure of the target folder matches the tree structure template of the application system.
[0054] Step 103: Based on the tree structure, mount the target files in the target folder to the application system.
[0055] The target file is the file to be mounted to the application system, such as a video file of pipeline defects. This embodiment does not specifically limit this.
[0056] The number of target files can be set according to actual needs, and this embodiment does not impose a specific limit on it.
[0057] The target file can be deployed in the target folder in various directory structures, such as the target file being deployed in a set of 4-level subdirectories of the target folder, or in a set of 5-level subdirectories of the target folder, etc. This embodiment does not make specific limitations on this.
[0058] Optionally, after obtaining the tree structure, the target files in the target folder can be mounted to the application system according to the obtained tree structure; the application system then displays the target files in the front end with the corresponding tree structure. This method ensures that the target files are mounted to the application system with a tree structure that matches the application system's tree structure template, improving the reliability of file mounting.
[0059] This embodiment automatically generates the tree structure of the target folder based on the set of first-level subdirectories under the root directory of the target folder and the tree structure template of the application system. This ensures that the tree structure of the target folder matches the tree structure template of the application system in any scenario, and that the target files in the target folder can be successfully mounted to the application system. This effectively improves the success rate and reliability of file mounting, thereby reducing the impact of mounting failures on the functionality of the target files.
[0060] Based on the above embodiments, the step of obtaining the tree structure of the target folder according to the set of first-level subdirectories and the tree structure template of the application system in this embodiment includes: determining the target level number according to the tree structure template of the application system; and recursively calling the target folder according to the set of first-level subdirectories and the target level number to obtain the tree structure of the target folder.
[0061] The target level is a boundary condition for the recursive call, used as a condition for returning node parameters when recursively filtering the subdirectory set of the target level; the target level is an integer.
[0062] Optionally, the method for determining the preset number of levels based on the tree structure template of the application system includes comparing the directory structure of the target folder with the tree structure template of the application system, obtaining the number of levels that are the same in the directory structure of the target folder and the tree structure template of the application system, and using the same number of levels as the preset number of levels.
[0063] like Figure 2 As shown, the target folder's directory structure is arranged hierarchically, consisting of the project folder, road folder, pipeline folder, pipeline defect video folder, and video files; for example... Figure 3 As shown, the tree structure template of the application system is arranged hierarchically, in the order of project folder, road folder, and video files; therefore, the number of levels in the target folder that are the same as the tree structure template of the application system is 3; correspondingly, the preset number of levels is 3.
[0064] Alternatively, a specific number of levels can be selected as the preset number of levels based on the number of levels in the tree structure template of the application system; for example, the first 3 levels can be selected as the preset number of levels; this embodiment does not specifically limit this.
[0065] Then, the set of first-level subdirectories and the target level are used as inputs to the recursive call algorithm. The algorithm recursively calls the target folder and outputs the tree structure of the target folder.
[0066] The recursive call algorithm includes a first recursive call algorithm and a second recursive call algorithm;
[0067] Optionally, when starting a recursive call, the first recursive call algorithm is used to perform a loop recursive call. The current level number is 0, that is, the recursive call starts from the set of first-level subdirectories under the root directory of the target folder. When calling the set of next-level subdirectories, the current level number is incremented by 1 until the current level number reaches the target level number. Then the first recursive call algorithm stops and returns the directory structure of the target level number of the target file.
[0068] Next, the second recursive call algorithm is used to iteratively call the files or folders after the target level of the target folder, return the target file of the target folder, and finally obtain the tree structure of the target folder based on the returned results.
[0069] by Figure 4 Taking the target folder shown as an example, the file mounting method in this embodiment will be described in detail.
[0070] First, obtain the set of first-level subdirectories under the root directory of the target folder, namely the set of subdirectories of the project 101 folder and the set of subdirectories of the project 102 folder;
[0071] Optionally, the first recursive call algorithm is used to recursively call the subdirectory set of project 101 folder and the subdirectory set of project 102 folder respectively until the current level number reaches the target level number, and then the directory structure of the target level number of the target file is returned.
[0072] like Figure 5 As shown, when the target level is 3, the directory structure of the target level of the returned target file's "Project 101" folder is arranged as follows: Project 101 folder, Minzu Avenue folder, and Rainwater Pipe folder.
[0073] Next, the second recursive call algorithm is used to iteratively call the video folders after the third level of the target folder, returning the video files, and finally obtaining the tree structure of the target folder based on the returned results.
[0074] like Figure 6 As shown, the second recursive call algorithm is used to iteratively call the video folders after the third level of the target folder, extracting the video files to generate the fourth-level nodes of the tree structure;
[0075] The hierarchical arrangement of the tree structure for the "Project 101" folder branch of the target file is as follows: Project 101 folder, Minzu Avenue folder, Rainwater Pipe folder, and Video Files.
[0076] This embodiment determines the target level number based on the tree structure template of the application system, and recursively calls the target folder according to the set of first-level subdirectories and the target level number to obtain the tree structure of the target folder. This ensures that the tree structure of each target folder has the same number of levels and matches the tree structure template, thereby enabling more effective mounting of target files in the target folder to the application system.
[0077] Based on the above embodiments, the recursive call to the target folder according to the first-level subdirectory set and the target level number to obtain the tree structure of the target folder includes: searching for the target subfolder in the first-level subdirectory set; if not found, writing it into the first-level node of the tree structure template according to the node parameters returned by the first-level subdirectory set; continuing to search for the target subfolder in the next-level subdirectory set of the first-level subdirectory set; if not found, writing it into the next-level node of the first-level node of the tree structure template according to the node parameters returned by the next-level subdirectory set, until the boundary condition is met; wherein, the boundary condition is determined according to the target level number; if the target subfolder is found, searching for the target file in the target subfolder, and writing it into the last-level node of the tree structure template according to the node parameters returned by the target file, thus obtaining the tree structure of the target folder.
[0078] The boundary conditions for recursive calls include: the target subfile is found when the current level's cumulative count reaches the target level's number, or when the current level's cumulative count is 1 less than the current level's cumulative count.
[0079] The current level cumulative count is the cumulative value of the level count of the currently searched subdirectory set.
[0080] The node parameters returned by each level of subdirectory set include parameters such as the directory name and access address in the subdirectory set. This embodiment does not specifically limit these parameters.
[0081] Optionally, the steps of recursively calling the target folder to obtain its tree structure include:
[0082] First, the cumulative number of levels in the searched sub-target set is referred to as the current level cumulative number. The current level cumulative number is set to 0. The target subfolder is searched in the first-level subdirectory set. If it is not found, the node parameter is returned according to the first-level subdirectory set and written to the first-level node of the tree structure template.
[0083] Increment the current level's cumulative count by 1, i.e., the current level's cumulative count is 1. Loop through the next level's subdirectory set in the first-level subdirectory set to search for the target subfolder. If not found, return the node parameter based on the next level's subdirectory set and write the node parameter to the next level node of the tree structure template.
[0084] Repeat the above recursive call until the boundary condition for the recursive call is met;
[0085] Optionally, if the target subfolder is found, the target subfolder is recursively called to find and obtain the target file in the target subfolder. The node parameter is returned based on the target file in the target subfolder, and the node parameter is written into the last level node of the tree structure template to obtain the tree structure of the target folder.
[0086] Based on the above embodiments, the node parameters returned by the target file in this embodiment include the file name and the file access path.
[0087] Optionally, if the target file is found in the target subfolder, the last-level node object of the tree structure template is constructed based on the target file, and the object attributes of the last-level node of the tree structure template are assigned according to the file name and file access path of the target file, so as to write the node parameters returned by the target file into the last-level node of the tree structure template to obtain the tree structure of the target folder.
[0088] Based on the above embodiments, the method of finding the target file in the target subfolder in this embodiment includes: reading the folder objects in the target subfolder level by level, and obtaining the target file from the folder objects.
[0089] Optionally, if the target subfolder contains a multi-level directory structure, the folder objects of each level of subdirectory in the target subfolder are read recursively until no subdirectory is found, at which point the recursion is terminated and the set of folder objects of the target subfolder is returned.
[0090] It should be noted that, in this process, the node parameters returned from each level of subdirectories in the target subfolder are no longer written into the tree structure template; they are only used to recursively search for the target file in the target subfolder and obtain the node parameters returned by the target file.
[0091] Then, the target file is searched for in the collection of folder objects, and the found target file is put into a new file collection;
[0092] The search can be conducted by searching based on the target file name or file format, etc., and this embodiment does not specifically limit this method.
[0093] Then, the target files in the new file set are recursively called. During the recursive call, the last-level node object of the tree structure template is constructed based on the target file. The object attributes of the last-level node of the tree structure template are assigned according to the file name and file access path of the target file. The node parameters returned by the target file are written into the last-level node of the tree structure template to obtain the tree structure of the target folder.
[0094] This embodiment reads the folder objects in the target subfolder level by level, which can quickly and accurately obtain the target file from the subfolder object and obtain the tree structure of the target folder.
[0095] Based on the above embodiments, the step of obtaining the target file from the folder object in this embodiment includes: obtaining the target file from the folder object according to the extension of the target file.
[0096] Optionally, target files can be retrieved from the folder object by looping through the folder object based on the file extension of the target file;
[0097] For example, if the target file is a video file with the extension .mp4, then you can search for files with the extension .mp4 in the folder object to quickly obtain the target file;
[0098] This embodiment can quickly and accurately obtain the target file from the folder object based on the file extension, effectively improving the accuracy and reliability of file mounting.
[0099] Based on the above embodiments, the method of obtaining the set of first-level subdirectories under the root directory of the target folder in this embodiment includes: matching the directory structure of the target folder with the tree structure template in the application system; and if there is no match, obtaining the set of first-level subdirectories under the root directory of the target folder.
[0100] Optionally, when it is necessary to mount the target files of the target folder to the application system, firstly, match the directory structure of the target folder with the tree structure template in the application system to determine whether they match.
[0101] If the two do not match, obtain the set of first-level subdirectories under the root directory of the target file. Based on the set of first-level subdirectories and the tree structure template of the application system, obtain the tree structure of the target folder. Based on the tree structure, mount the target file in the target folder to the application system.
[0102] If the two match, the target files in the target folder are directly mounted to the application system based on the directory structure of the target folder.
[0103] like Figure 2 and Figure 3 As shown, the target folder contains video files in its pipe folder, but the pipe folder also contains multiple levels of subdirectories; while the application system's tree structure template directly stores video files in its pipe file, without multiple levels of subdirectories; after comparing the directory structures, the two do not match.
[0104] After generating a tree structure for the target folder that matches the tree structure template of the application system, the target files in the target folder can be mounted to the application system so that all target files in the target folder can be displayed on the front end in a tree structure with a fixed model.
[0105] This embodiment first determines whether the directory structure of the target folder matches the tree structure template in the application system. If they match, the target files in the target folder are directly mounted to the application system based on the directory structure of the target folder. If they do not match, the target files in the target folder are mounted to the application system based on the generated tree structure. This ensures both a high success rate and efficient mounting.
[0106] the following Figure 4 The following describes the complete process of the file mounting method in this example, using the target folder shown as an example, the target file as a pipeline defect video file, and the target hierarchy as 3. The main steps include:
[0107] Step 1: Obtain the set of first-level subdirectories under the root directory of the target folder, i.e., obtain the set of multiple project directories;
[0108] Step 2: Determine the target number of levels based on the tree structure template of the application system;
[0109] Step 3: Call the recursive algorithm and pass in the relevant parameters of the target level number and the set of first-level subdirectories, and output the tree structure of the target folder; the boundary condition of the recursive algorithm is to find the target subfile or the cumulative number of the current level reaches the target level number.
[0110] Step 4: Based on the tree structure, mount the target files in the target folder to the application system so that the application system can display the target files in a tree structure.
[0111] It should be noted that when the boundary conditions are not met, the process proceeds recursively, continuing to call the next level subdirectory set, and the node parameters returned by the first level subdirectory set are written into the next level node of the tree structure template.
[0112] Optionally, the current level's cumulative count is incremented by 1, the target subfolder is searched in the next-level subdirectory set, and the node parameters returned by the next-level subdirectory set are written into the next-level node of the tree structure template until the boundary conditions are met; wherein, the target subfolder is a folder containing the word "pipe".
[0113] When the boundary conditions are met, i.e. the cumulative number of the current level is greater than 3 and the target subfolder is found, the folder objects in the target subfolder are only recursively obtained. The node parameters returned by the set of subdirectories at each level of the target subfolder are no longer written into the tree structure template until no subdirectory is found, and the recursive return of the set of folder objects is terminated.
[0114] Then, loop through the collection of folder objects, filter by extension in the loop to get the target file in the collection of folder objects, namely the pipeline defect video file, and put it into a new collection of video files;
[0115] Then, the new set of video files is looped through again. In the loop, the last-level node object of the tree structure template is constructed, that is, the fourth-level leaf node object. The object properties are assigned values, that is, the file name and file access path of the target file are assigned to the last-level node object to obtain the tree structure of the target folder.
[0116] The file mounting device provided by the present invention is described below. The file mounting device described below and the file mounting method described above can be referred to in correspondence.
[0117] like Figure 7 As shown, this embodiment provides a file mounting device, which includes a first acquisition module 701, a second acquisition module 702, and a mounting module 703, wherein:
[0118] The first acquisition module 701 is used to acquire the set of first-level subdirectories under the root directory of the target folder;
[0119] The file mounting method in this embodiment can be used for file mounting in various fields, such as mounting pipeline defect video files to an application system, or mounting industrial equipment operation data to an application system. This embodiment does not specifically limit this.
[0120] The file mounting method in this embodiment can be applied to different systems or devices, such as actuators; the actuator can be a computer, a server, or the cloud, etc., and this embodiment does not specifically limit it.
[0121] The target folder is the folder where the files to be mounted can be a folder containing video files of pipeline defects, or a folder containing operational data of industrial equipment, etc. This embodiment does not make specific limitations on this.
[0122] The target folder is stored in a multi-level structure in File Explorer;
[0123] Optionally, if it is necessary to mount the target folder in the resource manager to the application system, first obtain the set of first-level subdirectories under the root directory of the target folder according to the target structure of the target folder; where the root directory is the top-level directory of the target folder.
[0124] like Figure 2 As shown, the target folder's target structure is arranged hierarchically, consisting of the project folder, road folder, pipeline folder, and pipeline defect video folder, etc.; among them, the first-level subdirectories under the root directory of the target folder are the subdirectories of all project folders.
[0125] The second acquisition module 702 is used to acquire the tree structure of the target folder based on the set of first-level subdirectories and the tree structure template of the application system.
[0126] Optionally, based on the set of first-level sub-targets, hierarchical calls are made to each level of the target folder, and the node parameters of the tree structure are returned during the hierarchical call process. The node parameters are written into the tree structure template to obtain the tree structure of the target folder.
[0127] Since the tree structure of the target folder is obtained based on the tree structure template of the application system, the tree structure of the target folder matches the tree structure template of the application system.
[0128] The mounting module 703 is used to mount the target files in the target folder to the application system according to the tree structure.
[0129] The target file is the file to be mounted to the application system, such as a video file of pipeline defects. This embodiment does not specifically limit this.
[0130] The number of target files can be set according to actual needs, and this embodiment does not impose a specific limit on it.
[0131] The target file can be deployed in the target folder in various directory structures, such as the target file being deployed in a set of 4-level subdirectories of the target folder, or in a set of 5-level subdirectories of the target folder, etc. This embodiment does not make specific limitations on this.
[0132] Optionally, after obtaining the tree structure, the target files in the target folder can be mounted to the application system according to the obtained tree structure; the application system then displays the target files in the front end with the corresponding tree structure. This method ensures that the target files are mounted to the application system with a tree structure that matches the application system's tree structure template, improving the reliability of file mounting.
[0133] This embodiment automatically generates the tree structure of the target folder based on the set of first-level subdirectories under the root directory of the target folder and the tree structure template of the application system. This ensures that the tree structure of the target folder matches the tree structure template of the application system in any scenario, and that the target files in the target folder can be successfully mounted to the application system. This effectively improves the success rate and reliability of file mounting, thereby reducing the impact of mounting failures on the functionality of the target files.
[0134] Based on the above embodiments, the second acquisition module in this embodiment is specifically used to: determine the target level number according to the tree structure template of the application system; and recursively call the target folder according to the set of first-level subdirectories and the target level number to obtain the tree structure of the target folder.
[0135] Based on the above embodiments, the second acquisition module in this embodiment is further configured to: search for the target subfolder in the first-level subdirectory set; if not found, write it into the first-level node of the tree structure template according to the node parameters returned by the first-level subdirectory set; continue searching for the target subfolder in the next-level subdirectory set of the first-level subdirectory set; if not found, write it into the next-level node of the first-level node of the tree structure template according to the node parameters returned by the next-level subdirectory set, until the boundary conditions are met; wherein, the boundary conditions are determined according to the target level; if the target subfolder is found, search for the target file in the target subfolder, and write it into the last-level node of the tree structure template according to the node parameters returned by the target file, thereby obtaining the tree structure of the target folder.
[0136] Based on the above embodiments, the node parameters returned by the target file in this embodiment include the file name and the file access path.
[0137] Based on the above embodiments, the search module in the second acquisition module of this embodiment is used to: read the folder objects in the target subfolder level by level, and obtain the target file from the folder objects.
[0138] Based on the above embodiments, the search module in this embodiment is specifically used to: obtain the target file from the folder object according to the extension of the target file.
[0139] Based on the above embodiments, the first acquisition module in this embodiment is specifically used to: match the directory structure of the target folder with the tree structure template in the application system; and if there is no match, acquire the set of first-level subdirectories under the root directory of the target folder.
[0140] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840, wherein the processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a file mounting method, which includes: obtaining a set of first-level subdirectories under the root directory of the target folder; obtaining the tree structure of the target folder based on the set of first-level subdirectories and the tree structure template of the application system; and mounting the target files in the target folder to the application system according to the tree structure.
[0141] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0142] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the file mounting method provided by the above methods. The method includes: obtaining a set of first-level subdirectories under the root directory of the target folder; obtaining a tree structure of the target folder based on the set of first-level subdirectories and a tree structure template of the application system; and mounting the target files in the target folder to the application system based on the tree structure.
[0143] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the file mounting method provided by the above methods, the method comprising: obtaining a set of first-level subdirectories under the root directory of a target folder; obtaining a tree structure of the target folder based on the set of first-level subdirectories and a tree structure template of an application system; and mounting the target file in the target folder to the application system based on the tree structure.
[0144] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A file mounting method, characterized in that, include: Match the directory structure of the target folder with the tree structure template in the application system; If there is a mismatch, obtain the set of first-level subdirectories under the root directory of the target folder; The target level is determined based on the tree structure template of the application system; the target level is a boundary condition for recursive calls and is used as a condition for returning node parameters when recursively filtering the subdirectory set of the target level. Based on the set of first-level subdirectories and the target level, the target folder is recursively called to obtain the tree structure of the target folder; Based on the tree structure, the target files in the target folder are mounted to the application system; The step of recursively calling the target folder based on the set of first-level subdirectories and the target hierarchical number to obtain the tree structure of the target folder includes: The process involves searching for the target subfolder within the first-level subdirectory set. If not found, the node parameters returned by the first-level subdirectory set are written into the first-level node of the tree structure template. The search continues in the next-level subdirectory set of the first-level subdirectory set. If not found, the node parameters returned by the next-level subdirectory set are written into the next-level node of the tree structure template, until boundary conditions are met. These boundary conditions are determined based on the target level. If the target subfolder is found, the target file is searched within it. The node parameters returned by the target file are written into the last-level node of the tree structure template, thus obtaining the tree structure of the target folder. The step of searching for the target file in the target subfolder includes: if the target subfolder has a multi-level directory structure, recursively reading the folder objects of each level of subdirectory set in the target subfolder level by level, and obtaining the target file from the folder objects, wherein, during the reading process, the node parameters returned according to each level of subdirectory set in the target subfolder are no longer written into the tree structure template.
2. The file mounting method according to claim 1, characterized in that, The node parameters returned by the target file include the file name and the file access path.
3. The file mounting method according to claim 1 or 2, characterized in that, The step of searching for the target file in the target subfolder includes: Read the folder objects in the target subfolder level by level, and obtain the target file from the folder objects.
4. The file mounting method according to claim 3, characterized in that, The step of obtaining the target file from the folder object includes: The target file is obtained from the folder object based on its extension.
5. A file mounting device, characterized in that, include: The first acquisition module is used to match the directory structure of the target folder with the tree structure template in the application system; If there is a mismatch, obtain the set of first-level subdirectories under the root directory of the target folder; The second acquisition module is used to determine the target number of levels based on the tree structure template of the application system; The target level is a boundary condition for recursive calls, used as a condition for returning node parameters when recursively filtering the subdirectory set of the target level. Based on the set of first-level subdirectories and the target level, the target folder is recursively called to obtain the tree structure of the target folder; The mounting module is used to mount the target files in the target folder to the application system according to the tree structure. The second acquisition module is further configured to: search for the target subfolder in the first-level subdirectory set; if not found, write it into the first-level node of the tree structure template according to the node parameters returned by the first-level subdirectory set; continue searching for the target subfolder in the next-level subdirectory set of the first-level subdirectory set; if not found, write it into the next-level node of the first-level node of the tree structure template according to the node parameters returned by the next-level subdirectory set, until the boundary conditions are met; wherein the boundary conditions are determined according to the target level; if the target subfolder is found, search for the target file in the target subfolder, and write it into the last-level node of the tree structure template according to the node parameters returned by the target file, thereby obtaining the tree structure of the target folder; The step of searching for the target file in the target subfolder includes: if the target subfolder has a multi-level directory structure, recursively reading the folder objects of each level of subdirectory set in the target subfolder level by level, and obtaining the target file from the folder objects, wherein, during the reading process, the node parameters returned according to each level of subdirectory set in the target subfolder are no longer written into the tree structure template.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the file mounting method as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the file mounting method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Method and system for rapidly displaying files through multimedia file manager
CN105653617A
Data obtaining method and device and data providing method and device
CN111258958A
Information processing method, device and equipment
CN113094737A