CN114416657A - File management method, device, terminal and storage medium - Google Patents
File management method, device, terminal and storage medium Download PDFInfo
- Publication number
- CN114416657A CN114416657A CN202111636172.4A CN202111636172A CN114416657A CN 114416657 A CN114416657 A CN 114416657A CN 202111636172 A CN202111636172 A CN 202111636172A CN 114416657 A CN114416657 A CN 114416657A
- Authority
- CN
- China
- Prior art keywords
- folder
- content
- file
- name
- management method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
- G06F16/162—Delete operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a file management method, a device, a terminal and a storage medium, wherein the method comprises the steps of judging whether a designated folder is modified or not; if the modification occurs, updating the preset content table based on the modified content hierarchy information of the designated folder; the content hierarchy information includes: the name of the parent folder, the level and the name of the child folder, and the level and the name of the child folder; and updating a preset structure table based on the updated content table. The contents of the folder are maintained through the two tables, so that the inquiry of the contents of the file is more convenient, and the consistency of file data is also ensured.
Description
Technical Field
The present invention relates to the field of computers, and in particular, to a file management method, device, terminal, and storage medium.
Background
The newly developed editor needs to store files and perform operations such as related addition, deletion, modification, check and the like. The file organization structure and the related management logic affect the read-write speed, the stability and the security of the stored content, and further affect the subsequent logic based on the file content.
Disclosure of Invention
In view of the above, the present application provides a file management method, including:
judging whether the specified folder is modified or not;
if the modification occurs, updating the preset content table based on the modified content hierarchy information of the designated folder; the content hierarchy information includes: the name of the parent folder, the level and the name of the child folder, and the level and the name of the child folder;
and updating a preset structure table based on the updated content table.
Further, the method also comprises the following steps: when the initial specified folder is obtained, generating the initial content table based on the content hierarchy information of the initial specified folder, and generating the initial structure table based on the initial content table.
Further, the modifying includes: deleting;
when the deletion operation is performed, the updating includes:
determining a subfolder of the highest hierarchy corresponding to the name of the deleted part in the designated folder in the content table;
and all the related attached information in the subfolder of the highest layer is deleted.
Further, the modifying includes: renaming, the updating comprising, when the renaming operation is performed:
copying the existing table of contents to obtain a new table of contents; determining a renamed file or folder; based on the determined location of the file or folder in the new table of contents; modifying the content of the determined position into a renamed name; the existing table of contents is deleted.
Further, the modifying includes: copying;
when performing the copy operation, the updating includes: determining the copied files in the specified folder in the content table, copying all subfolders and subfile information of the copied folder to a specified position in sequence, and modifying the name of the copied folder.
Further, the method also comprises the following steps:
when searching operation is carried out, a corresponding file is found in the content table through the name of the target file, and the storage path of the target file is obtained through recursion in sequence according to the father node information of the target file, and the path is returned to a user.
Further, the method also comprises the following steps:
when loading is needed, storing the file information needed to be loaded as a file in a preset format;
and correspondingly storing the content of the file into the content table and the structure table.
Further, the present application also provides a file management apparatus, including:
the judging module is used for judging whether the specified folder is modified or not;
the modification module is used for updating a preset content table based on the modified content level information of the specified folder if the modification occurs; the content hierarchy information includes: the name of the parent folder, the level and the name of the child folder, and the level and the name of the child folder;
and the synchronization module is used for updating a preset structure table based on the updated content table.
Further, the present application also provides a computer terminal, which includes a processor and a memory, where the memory stores a computer program, and the computer program executes the file management method in any one of the above embodiments when running on the processor.
Further, the present application also provides a readable storage medium storing a computer program, which when executed on a processor performs the file management method according to any of the above embodiments.
The embodiment of the application provides a file management method, which comprises the steps of judging whether a specified folder is modified or not; if the modification occurs, updating the preset content table based on the modified content hierarchy information of the designated folder; the content hierarchy information includes: the name of the parent folder, the level and the name of the child folder, and the level and the name of the child folder; and updating a preset structure table based on the updated content table. The folder contents are maintained through the two tables with different structures, the content tables are easier to query, the structure tables guarantee the structure of the folder to be stored, and meanwhile, the consistency and the correctness of file data are also guaranteed through the synchronization of the two tables.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings required to be used in the embodiments will be briefly described below, and it should be understood that the following drawings only illustrate some embodiments of the present invention, and therefore should not be considered as limiting the scope of the present invention. Like components are numbered similarly in the various figures.
FIG. 1 is a flowchart illustrating a file management method according to an embodiment of the present application;
FIG. 2 is a schematic diagram showing the structure of a structure table in the embodiment of the present application;
FIG. 3 is a schematic structural diagram of a content hierarchy information table in the embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a file management apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first", "second", "third", and the like are used only for distinguishing descriptions and are not to be construed as indicating or implying relative importance, and the term "file information" herein generally refers to information of relationships stored within folders and information of files stored.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
The technical solution of the present invention will be described with specific examples.
Example 1
Specifically, as shown in the flow chart diagram in fig. 1, the present scheme includes the following steps:
step S100, judging whether the specified folder is modified;
in this embodiment, the editor may need to perform storage management on the read files, and in order to manage these stored files, two tables, one table is called a content table, as shown in fig. 2, where information is stored for each folder and the files in the folder, and in the table, a data structure of each representative folder stores the ID, name, parent folder index, stored folder, and the files stored in the folder. Each folder is stored with its own name as a key, and in the table of contents, the data structures of each folder have no inclusion relationship, but are simply listed, and the data structure records its parent folder and the subfolders stored in the folder.
The other table is a structure table, and is based on the content table, the data in the table is arranged into a tree structure, specifically, as shown in fig. 3, the first folder includes two subfolders, which are a second folder and a third folder, respectively, where the second folder stores three subfiles and the third folder stores one subfile.
The structure table is displayed on an interface of the editor through hierarchy and structure, so that a user can intuitively know the storage relation among files. And the table of contents is not presented on the interface.
When no folder and file exist at first, the two tables have no content, when the first folder is initialized, the information of the folder is stored in the content table, and then the data in the content table is stored in the structure table in a tree form.
And judging whether the appointed folder is modified, comparing the content of the current folder with the recorded content table, and if the data information in a certain folder is found to be different from the content table, judging that the folder is modified.
Step S200, if the file is modified, updating a preset content table based on the modified content level information of the designated folder; the content hierarchy information includes: the name of the parent folder, the level and name of the child folder, and the level and name of the child folder.
When a modification operation occurs, the table of contents needs to be updated, specifically, the modification operation includes addition, deletion, copy, and renaming. When the corresponding modification operation occurs, the data recorded in the table of contents is changed according to the corresponding operation.
Specifically, when the deletion operation is performed, the specified folder is first found in the table of contents by the name of the folder to be deleted, and then the subfiles and the subfolders are sequentially deleted from the subfiles and the subfolders according to the information in the specified folder, that is, the subfiles and the subfolders are found according to the names of the subfiles and the subfolders recorded in the specified folder, and then the above operation is repeated until there are no subfolders or subfiles in the folder, and then the sequential deletion is started. When the contents of the specified folder are deleted, the specified folder is deleted, if the folder has a parent folder, the information of the folder is deleted from the parent folder, and thus, when the deletion operation is completed, the content table is updated.
When renaming operation is carried out, the existing table of contents is copied to obtain a new table of contents, so that the original table of contents can be used as an index of the new table of contents; then determining a renamed file or folder in the new table of contents; based on the determined location of the file or folder in the new table of contents; modifying the content of the determined position into a renamed name; the existing table of contents is deleted.
When copying, the copied folder has its own name, and before this, the designated folder needs to be found in the table of contents by the name of the designated folder that needs to be copied, and after finding, all the subfolders and subfiles in the folder are copied to the designated positions in sequence.
When the adding operation is performed, similar to the initializing folder operation, after a new folder is added, the data of the corresponding ID, name, parent folder index, subfolder, and subfile are saved for the folder in the content table, and are saved in the content table.
And step S300, updating a preset structure table based on the updated content table.
After the content table is updated, the data is sorted into a tree structure according to the structure in the content table, and then the sorted structure is stored in the structure table, so that the data unification of the structure table and the content table is completed.
Further, there may be query and load operations in addition to the modify operations described above.
Specifically, when a search operation is performed, a content table is queried by keywords input during the query, generally, the queried keywords are file names, and each folder in the content table has no hierarchical relationship, so that a specified folder is easily searched, and the storage location of the target file can be obtained by sequentially recursion according to parent folder information in the folder, thereby realizing a rapid search process.
When a user opens the editor and starts to load a file, the stored file information is read into a preset file format, such as a json file format, and then the file content is stored in a content table and a structure table, so that the consistency of file data is ensured.
According to the file storage method and device, the content table and the structure table are set, so that the unification of folder data is guaranteed, the structure of the content table is simple, besides information of parent folders is stored in each file, the folders do not contain relations, the query addition and deletion operation inside a program is facilitated, the structure table stores the mutual containing relations among the folders in a tree structure besides the content data of all the folders, a user can clearly know the file storage structure according to the structure table, and subsequent operation editing is conducted.
Example 2
The embodiment of the present application further provides a file management apparatus, as shown in fig. 4, the apparatus includes a determining module 10, a modifying module 20 and a synchronizing module 30.
And the judging module 10 is used for judging whether the specified folder is modified.
A modification module 20, configured to update a preset content table based on the modified content hierarchy information of the designated folder if the modification occurs; the content hierarchy information includes: parent folder, child folder and child file.
And the synchronization module 30 is configured to update a preset structure table based on the updated content table.
Further, the present application also provides a computer terminal, which includes a processor and a memory, where the memory stores a computer program, and the computer program executes the file management method in any one of the above embodiments when running on the processor.
Further, the present application also provides a readable storage medium storing a computer program, which when executed on a processor performs the file management method according to any of the above embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention.
Claims (10)
1. A file management method, comprising:
judging whether the specified folder is modified or not;
if the modification occurs, updating the preset content table based on the modified content hierarchy information of the designated folder; the content hierarchy information includes: the name of the parent folder, the level and the name of the child folder, and the level and the name of the child folder;
and updating a preset structure table based on the updated content table.
2. The file management method according to claim 1, further comprising: when the initial specified folder is obtained, generating the initial content table based on the content hierarchy information of the initial specified folder, and generating the initial structure table based on the initial content table.
3. The file management method according to claim 1, wherein said modifying includes: deleting operation;
when the deletion operation is performed, the updating includes:
determining a subfolder of the highest hierarchy corresponding to the name of the deleted part in the designated folder in the content table;
and deleting all the information of the subfolders at the highest layer and the related auxiliary information.
4. The file management method according to claim 1, wherein said modifying includes: a renaming operation, when performed, the updating comprising:
copying the existing table of contents to obtain a new table of contents; determining a renamed file or folder; based on the determined location of the file or folder in the new table of contents; modifying the content of the determined position into a renamed name; the existing table of contents is deleted.
5. The file management method according to claim 1, wherein said modifying includes: copying;
when performing the copy operation, the updating includes: determining the copied file in the specified folder in the content, copying all subfolders and subfile information of the copied folder to a specified position in sequence, and modifying the name of the copied folder.
6. The file management method according to claim 1, further comprising:
when searching operation is carried out, a corresponding target file is found in the content table through the name of the searched file, the information of the hierarchy of the target file is determined, and the information of the hierarchy is returned to a user.
7. The file management method according to claim 1, further comprising:
when loading is needed, storing the file information needed to be loaded as a file in a preset format;
and correspondingly storing the content of the file into the content table and the structure table.
8. A file management apparatus, characterized by comprising:
the judging module is used for judging whether the specified folder is modified or not;
the modification module is used for updating a preset content table based on the modified content level information of the specified folder if the modification occurs; the content hierarchy information includes: the name of the parent folder, the level and the name of the child folder, and the level and the name of the child folder;
and the synchronization module is used for updating a preset structure table based on the updated content table.
9. A computer terminal, characterized in that it comprises a processor and a memory, said memory storing a computer program which, when run on said processor, executes the file management method of any one of claims 1 to 7.
10. A readable storage medium, characterized in that it stores a computer program which, when run on a processor, performs the file management method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111636172.4A CN114416657A (en) | 2021-12-29 | 2021-12-29 | File management method, device, terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111636172.4A CN114416657A (en) | 2021-12-29 | 2021-12-29 | File management method, device, terminal and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114416657A true CN114416657A (en) | 2022-04-29 |
Family
ID=81268705
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111636172.4A Pending CN114416657A (en) | 2021-12-29 | 2021-12-29 | File management method, device, terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114416657A (en) |
-
2021
- 2021-12-29 CN CN202111636172.4A patent/CN114416657A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7711754B2 (en) | System and method for managing data using static lists | |
AU2004208274B2 (en) | Method and system for managing media file database | |
US9830324B2 (en) | Content based organization of file systems | |
US7130867B2 (en) | Information component based data storage and management | |
US9697258B2 (en) | Supporting enhanced content searches in an online content-management system | |
US8694497B2 (en) | Method, system, and computer program product for enabling file system tagging by applications | |
US7769719B2 (en) | File system dump/restore by node numbering | |
US20070276848A1 (en) | Apparatus and method for managing data | |
CN108470040B (en) | Method and device for warehousing unstructured data | |
US20070156778A1 (en) | File indexer | |
JP2005302038A (en) | Method and system for renaming consecutive key in b-tree | |
CN114625696B (en) | File recovery method and device, electronic equipment and storage medium | |
CN113392068A (en) | Data processing method, device and system | |
CN113342741B (en) | Snapshot implementation method and device, electronic equipment and computer readable storage medium | |
CN114416657A (en) | File management method, device, terminal and storage medium | |
JP2006164276A (en) | Device and method for processing file system path | |
CN114564449B (en) | Data query method, device, equipment and storage medium | |
CN117349236B (en) | File reading method, device, equipment and storage medium | |
CN117282108A (en) | Resource merging method, device, equipment and storage medium | |
US20230147552A1 (en) | Methods and systems for ordering operations on a file system having a hierarchical namespace | |
CN113282551A (en) | Data processing method, system and equipment | |
US20050228833A1 (en) | Method for managing multimedia data | |
CN116991460A (en) | Data set file version control method and system based on graph database | |
CN115982104A (en) | Tool for quickly retrieving modified items in folder based on computer | |
CN116737659A (en) | Metadata management method for file system, terminal device and computer storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |