Folder mounting method and device, equipment and storage medium

By generating a difference list in the folder mounting method and filtering out change operations that do not conform to the policy, the problem of data corruption caused by indiscriminate synchronization is solved, achieving flexible and fine-grained file protection and improving data security.

CN120956735APending Publication Date: 2025-11-14SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511023152.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-23
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing folder mounting methods result in indiscriminate synchronization, leading to accidental manipulation or corruption of data in the client's source folder, and lack a flexible, configurable protection mechanism.

Method used

After comparing the temporary image with the source folder, a difference list is generated. Change operations that do not conform to the preset file protection policy are filtered out, and a synchronization list is generated, synchronizing only change operations that conform to the policy.

Benefits of technology

It prevents changes that do not conform to the preset file protection policy from being applied to the source folder, thereby improving data security during the folder mounting and synchronization process and achieving fine-grained file protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120956735A_ABST
    Figure CN120956735A_ABST
Patent Text Reader

Abstract

The invention discloses a folder mounting method, device and equipment and a storage medium, and relates to the technical field of computer remote management, the method is applied to a system composed of a client and a server, the client makes a local source folder into a temporary mirror image and mounts the temporary mirror image to the server for access, and the method is executed by the client. After the mount is disconnected, the temporary mirror image is compared with the source folder to identify all file changes occurring on the server, and a difference list is formed. And according to a preset file protection strategy, reviewing the difference list, and screening out change operations which do not accord with the protection strategy, so as to obtain a synchronization list. Finally, only the change operation in the synchronization list is executed, and updating of the source folder is completed. By introducing the strategy-based filtering step before the synchronization execution, the file in the remote environment can be effectively prevented from being synchronized to the local by misoperation, so that the data security of the source folder is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer remote management technology, and in particular to a folder mounting method, apparatus, device and storage medium. Background Technology

[0002] In remote server management technology, a common file-sharing method involves using the client's folder mounting function to provide a temporary mirror of the client's local source folder to the remote server for access. All file operations performed on this temporary mirror by the server, such as creation, modification, or deletion, are synchronized back to the client's source folder when the mount is disconnected. However, this synchronization mechanism is typically indiscriminate; it applies all changes occurring on the server, including user errors, to the source folder without distinction. This introduces data security risks, potentially leading to the accidental modification or permanent deletion of important files in the source folder.

[0003] Therefore, there is an urgent need for a folder mounting method that can review and filter changes made to a temporary image before synchronizing them back to the source folder, allowing only safe operations that conform to preset policies to be executed. Summary of the Invention

[0004] This application provides a folder mounting method, apparatus, device, and storage medium to at least solve the problem in related technologies where client source folder data is mistakenly manipulated or corrupted due to indiscriminate synchronization.

[0005] This application provides a folder mounting method, which is applied to a computer system including a client and a server. The client provides the source folder to the server as a temporary mirror through a mounting operation. The method is executed by the client and includes:

[0006] In response to the received command to disconnect the temporary image mount, the temporary image is compared with the source folder, and a difference list is generated; the difference list is used to characterize the file change operations that have occurred in the temporary image;

[0007] The difference list is filtered to exclude changes that do not conform to the preset file protection policy, and a synchronization list is generated.

[0008] Based on the synchronization list, perform synchronization on the source folder to apply the file changes contained in the synchronization list.

[0009] This application also provides a folder mounting device, which is applied to a computer system including a client and a server. The client provides the source folder to the server as a temporary mirror through a mounting operation. The device is executed by the client and includes:

[0010] The comparison module, in response to a received command to disconnect the temporary image mount, compares the temporary image with the source folder and generates a difference list; the difference list is used to characterize the file change operations that occurred in the temporary image.

[0011] The filtering module is used to filter the difference list to exclude changes that do not conform to the preset file protection policy and generate a synchronization list.

[0012] The synchronization module is used to perform synchronization on the source folder based on the synchronization list, so as to apply the file change operations contained in the synchronization list.

[0013] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the above-described folder mounting methods when executing the computer program.

[0014] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the above-described folder mounting methods.

[0015] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described folder mounting methods.

[0016] This application adds a filtering step after generating a difference list representing all file change operations and before performing final synchronization on the source folder. This step reviews each change operation in the difference list according to a preset file protection policy, excluding those that do not conform to the policy and retaining only those that do form a synchronization list. Finally, the synchronization operation is strictly performed according to this filtered synchronization list. Therefore, this application can prevent change operations that do not conform to the preset file protection policy from being applied to the source folder, solving the technical problem in the prior art where all changes are synchronized indiscriminately, which may lead to data corruption in the source folder due to accidental operations on the server, thus improving data security during the folder mounting and synchronization process. Attached Figure Description

[0017] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic flowchart illustrating a folder mounting method provided in an embodiment of this application.

[0019] Figure 2 This is a schematic diagram of a folder mounting system provided in an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of the differential filtering module processing flow provided in an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of the file synchronization module processing flow provided in the embodiments of this application;

[0022] Figure 5 This is a schematic diagram of the structure of a folder mounting device provided in an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0025] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0026] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0027] The specific application environment architecture or specific hardware architecture on which the folder mounting method depends is described here.

[0028] First, let me introduce the terminology used in this application.

[0029] KVM: Keyboard, Video, Mouse; KVM is a hardware or software technology whose core function is to allow users to remotely access and control one or more computers or servers using a set of keyboards, monitors, and mice.

[0030] BMC: Baseboard Management Controller; the BMC is a standalone microcomputer (or microcontroller) embedded on the server motherboard. It has its own processor, memory, storage, and network connectivity, operating independently of the server's main CPU and operating system. The primary function of the BMC is to enable out-of-band management of the server, meaning that regardless of whether the server's main operating system is powered on, powered off, or crashed, administrators can connect to the BMC via the network to monitor it, control its power, perform firmware updates, and remotely operate it (e.g., via KVM).

[0031] IPMI: Intelligent Platform Management Interface; IPMI is an industry-standard specification that defines various interfaces and protocols for out-of-band management. The Base Management Controller (BMC) is typically the core hardware implementing the IPMI specification. Through IPMI, different management software and hardware can communicate with the BMC in a standardized way to acquire sensor readings, view event logs, control server power, and perform other management tasks.

[0032] JSON: JavaScript Object Notation; JSON is a lightweight, text-based data-interchange format. It is easy to read and write, and also easy for machines to parse and generate.

[0033] Scope: In a JSON structure, Scope is a key field used to define the path range within which a rule item applies. Its value is a specific directory path, indicating that all protection rules defined in this rule item only apply to this specified directory and its files and subdirectories.

[0034] Rules: In the JSON object of a rule item, Rules is an array. It contains one or more specific protection rule objects, which together constitute the complete protection policy that is in effect under this scope.

[0035] RuleType: Rule type; within a specific rule object, RuleType specifies the type of protection. It clarifies which type of restriction operation to perform. For example, NoModification means prohibiting modification or deletion, and NoCreation means prohibiting creation.

[0036] Regex: Regular Expression; In a specific rule object, Regex is a key field whose value is a regular expression string. Regular expressions are a powerful text pattern matching language that allows users to define very flexible and complex matching rules to precisely specify which filenames need to be protected by the RuleType.

[0037] Operation: In the JSON structure of the difference list, Operation is a key field used to describe the specific type of change operation performed on a file. For example, Create indicates a creation operation, Modify indicates a modification operation, and Delete indicates a deletion operation.

[0038] HOST: Host; HOST can be used to target devices that can be remotely controlled by KVM, i.e., servers.

[0039] In server remote management technology, a common practice is to use the KVM (keyboard, video, mouse) functionality provided by the Baseboard Management Controller (BMC) to mount the client's local folder as a temporary mirror to the remote server, enabling convenient file access and manipulation. In this existing technology, any file changes made by the server to this temporary mirror, including creating, modifying, or deleting files, are automatically and indiscriminately synchronized back to the client's source folder by the KVM client software when the user disconnects the mount connection. However, this synchronization mechanism has a serious flaw: the entire synchronization process is transparent to the user, who cannot predict, intervene, or control which changes will be executed. This means that any accidental deletion or modification of files during remote operations will be faithfully copied back to the local machine, directly causing permanent damage or loss of important data in the source folder, posing a serious data security risk. Furthermore, existing technologies generally lack a flexible, configurable protection mechanism, failing to apply fine-grained protection strategies based on file path, filename characteristics, or operation type (such as prohibiting creation or deletion).

[0040] Therefore, there is an urgent need for a folder mounting method that can provide a controllable, policy-based filtering mechanism before synchronizing changes from a temporary image back to the source folder. This mechanism should allow users to define flexible and granular protection rules according to their own needs, in order to solve the problem of remote misoperation or accidental damage to the client's source folder data due to indiscriminate synchronization in existing technologies.

[0041] This application provides a folder mounting method, and the method is described in detail below with reference to its execution flow. The folder mounting method of this embodiment is applied to a computer system including a client and a server. The client provides the source folder to the server as a temporary mirror through a mounting operation. This method is executed by the client. The method flow of the folder mounting method of this embodiment is as follows: Figure 1 As shown, it includes the following steps:

[0042] S101. In response to the received instruction to disconnect the temporary image mount, compare the temporary image with the source folder and generate a difference list.

[0043] Specifically, this method is executed in a computer system containing both a client and a server. In this method, the client is the primary executor; it mounts its local source folder as a temporary mirror image to the server for access. Upon receiving the command to end the mount, the client initiates a comparison program to examine the modifications the server made to the folder during the access period. The final output of this step is a list that comprehensively records all file modifications performed by the server.

[0044] The command to disconnect the temporary image mount is an external command sent to the client. Its purpose is to notify the client that the server's access session to the folder needs to end. The temporary image is not the original folder itself on the client, but a copy or reflection of the source folder. All server operations are performed on this temporary image, thus isolating it from the source folder. The source folder refers to the original folder located locally on the client and which is mounted.

[0045] The difference list is the result of comparison operations, used to characterize file change operations that occurred in the temporary image. File change operations refer to the specific actions performed by the server on files within the temporary image during access, such as creating a new file, modifying an existing file, or deleting a file.

[0046] S102. Filter the difference list to exclude change operations that do not conform to the preset file protection policy, and generate a synchronization list.

[0047] Specifically, this step receives the list of all changes (difference list) generated in the previous step, and then reviews each change on the list one by one according to a set of predefined rules. Changes that do not conform to the rules are removed, and only changes that conform to the rules are retained to form a new, approved list.

[0048] The default file protection policy is a set of pre-set rules or standards that define which types of file modification operations are allowed and which are not.

[0049] S103. Based on the synchronization list, perform synchronization on the source folder to apply the file change operations contained in the synchronization list.

[0050] Specifically, this step operates based on the approved list (synchronization list) generated in the previous step, applying each change listed on the list to the client's original folder to complete the final update.

[0051] Applying the file change operations contained in the synchronization list refers to performing actual operations on the source folder for each file change (such as creation, modification, or deletion) recorded in the synchronization list, thereby changing its status.

[0052] The folder mounting method provided in this application adds a filtering step after generating a difference list representing all file change operations and before performing final synchronization on the source folder. This step reviews each change operation in the difference list according to a preset file protection policy, excluding those that do not conform to the policy and retaining only those that do conform to the policy to form a synchronization list. Finally, the synchronization operation is strictly performed according to this filtered synchronization list. Therefore, this application can prevent change operations that do not conform to the preset file protection policy from being applied to the source folder, solving the technical problem in the prior art where all changes are synchronized indiscriminately, which may lead to data corruption of the source folder due to accidental operations on the server, thus improving the data security of the folder mounting and synchronization process.

[0053] In one optional implementation, the preset file protection policy includes at least one rule item; the rule item is used to characterize the protection rules for a specific path range within the source folder.

[0054] Rule items are the basic building blocks of a default file protection policy, and the entire protection policy is composed of at least one such rule item. A specific path range is the target area where a rule item applies, meaning that each rule item does not affect the entire source folder, but only a specific subdirectory or path within the source folder.

[0055] By breaking down the overall protection strategy into rule items that can be applied to specific path ranges within the source folder, protection is no longer a single, general instruction targeting the entire folder. Therefore, it can solve the technical problem in existing technologies that cannot provide differentiated and hierarchical protection for directories of different importance, achieving a refined file protection effect that allows for the configuration of independent protection strategies for different subdirectories according to specific business needs.

[0056] In one alternative implementation, the protection rule includes a rule type and a matching expression used to match filenames.

[0057] The rule type is a component of a protection rule; it defines the behavior or type of protection. Specifically, it specifies which file modification operations are prohibited. The matching expression is another component of a protection rule; it defines the objects of protection. It's a pattern used to identify filenames; only files whose filenames match this pattern are subject to the protection rule.

[0058] By breaking down protection rules into two dimensions—rule type and matching expression—it is possible to apply specific types of protection to files in a specific path that conform to a specific naming pattern.

[0059] By further decomposing protection rules into rule types that define protection behaviors and matching expressions that define protected objects, protection policies can be extended from the directory level to the file level. Therefore, it can solve the technical problem of not being able to distinguish and protect files of different file types or naming rules in the same directory. This achieves a more precise and flexible technical effect, which is to apply specific protection to files that conform to a specific filename pattern within a specified path range.

[0060] In one optional implementation, the rule types include: a first rule type that prohibits modifying or deleting files, and a second rule type that prohibits creating files; the matching expression is a regular expression. This embodiment clarifies that the method can provide at least two core protection capabilities (prevention of modification / deletion, and prevention of creation), and employs powerful regular expressions to achieve precise targeting of the protected object.

[0061] By explicitly providing two rule types—prohibiting modification or deletion and prohibiting creation—and employing powerful regular expressions as the matching tool, this approach offers users specific technical means to directly address common risk scenarios. Therefore, it solves the core technical problem in existing technologies where data corruption occurs due to the inability to prevent accidental deletion / modification and the creation of unintended files. This achieves a practical and efficient protection effect that effectively prevents critical files from being damaged and maintains the purity of specific directory contents.

[0062] In one alternative implementation, the file change operations in the diff list include at least one of creation, modification, and deletion operations. Creation, modification, and deletion operations are specific classifications of file change operations. They specify the three basic file operations that the diff list can recognize and record: creating a new file (create), changing the contents of an existing file (modify), and removing an existing file (delete).

[0063] Since a clear difference list can represent the three complete change operations of creation, modification, and deletion, it can solve the technical vulnerability that may lead to certain violations going undetected and unfiltered due to a mismatch between detection and protection capabilities. This achieves the technical effect of building a logically rigorous detection and filtering system without obvious weaknesses.

[0064] In one alternative implementation, the preset file protection policy, the difference list, and the synchronization list are all stored and represented in JSON format.

[0065] By specifying that all critical data structures (protection policies, difference lists, synchronization lists) are represented in a standardized JSON format, these data are not only clearly structured and easy for programs to parse, but also easy to read and write. Therefore, it can solve the technical problems of difficult configuration, high development and integration complexity caused by using complex or proprietary data formats. It achieves the beneficial technical effect of providing powerful functions while also being convenient for configuration management and easy for engineering implementation.

[0066] In one alternative implementation, filtering the difference list includes:

[0067] For any change operation in the difference list, determine whether the operation type and file name of the change operation match the rule type and matching expression of any protection rule; if they match, the change operation is considered to be inconsistent with the preset file protection policy.

[0068] If the change operations in the difference list include a deletion operation targeting the target directory, then determine whether the target directory is a specific path range or an ancestor directory of a specific path range defined in any rule item; if so, then the deletion operation is considered to be inconsistent with the preset file protection policy.

[0069] Exclude all change operations from the difference list that are deemed not to comply with the default file protection policy.

[0070] This step describes a filtering process that includes two decision logics and a final execution action.

[0071] The first step is explicit rule filtering, which is the first logical step in the filtering process. It iterates through each change in the difference list. For each change, it checks whether the operation type and the filename involved match any of the previously defined protection rules (consisting of rule type and matching expression). If a match is found, it means that the change violates a user-defined protection rule and is therefore deemed non-compliant.

[0072] Secondly, there's implicit rule filtering, which is the second and special judgment logic in the filtering process. It specifically handles directory deletion operations. If a change operation involves deleting a directory, the system will determine whether the target directory itself is a specific path range defined by a rule, or whether it is the parent directory (i.e., ancestor directory) of any specific path range. If either condition is met, the deletion operation will be considered non-compliant, even without an explicit rule prohibiting deletion. Here, the target directory refers to the directory marked for deletion in the difference list. Ancestor directories refer to all parent directories above the current directory in a file path.

[0073] Finally, exclusion is performed, which is the final action in the filtering process. All change operations identified in the previous two judgment logics as not conforming to the preset file protection policy are removed from the difference list.

[0074] By employing a dual filtering logic, which not only reviews changes based on user-defined rule types and matching expressions (explicit rules) but also adds deletion protection for specific path ranges and their ancestor directories (implicit rules), it can solve the problem that a single filtering logic cannot prevent the deep-seated security risks of indirectly undermining protection strategies by deleting parent directories. This achieves the technical effect of building a more secure and robust file protection system that can both meet users' refined protection needs and effectively prevent the protection mechanism from being circumvented.

[0075] Furthermore, the protection rules also include conditional attribute rules associated with the rule type and the matching expression; the step of filtering the difference list further includes: for change operations that match the matching expression, further obtaining the metadata of the files involved in the change operation, and determining whether the metadata meets the conditional attribute rules; only when the change operation does not meet the rule type and the metadata of its files meets the conditional attribute rules is the change operation identified as not meeting the preset file protection strategy.

[0076] The folder mounting method in this application includes: before generating the difference list, identifying the file system type of the client where the source folder is located and the file system type used by the temporary image respectively; the preset file protection policy is defined based on a general protection model, which includes general attributes across file systems, such as ownership, read / write / execute permissions; the step of filtering the difference list includes: converting the protection policy defined based on the general protection model into specific rules for the file system type according to the file system type of the temporary image, and then performing filtering.

[0077] The rule type further includes a third rule type: requiring user confirmation; the step of filtering the difference list accordingly generates a synchronization list and a pending list, the pending list containing all change operations that match the third rule type; the method further includes, before performing synchronization based on the synchronization list: presenting the pending list to the client to obtain a user's confirmation or rejection instruction for each change operation in the pending list; and, based on the user's confirmation instruction, moving the confirmed change operations in the pending list into the synchronization list.

[0078] In summary, the folder mounting method provided in this application, by introducing a core filtering process before file synchronization and constructing a complete and progressive protection system around this process, firstly achieves refined and configurable protection from the directory level to the file level by defining rule items within a specific path range and refining these rule items into combinations of rule types and regular expressions. Secondly, by ensuring that the system can detect all change operation types corresponding to the defined protection rules, a logical closed loop of detection and protection is formed. Finally, its core filtering step not only executes the explicit protection rules explicitly defined by the user, but also creatively adds a set of implicit rules that protect the integrity of the policy itself, i.e., automatically protecting the controlled directory and all its parent directories from being deleted. Therefore, it can simultaneously solve the superficial problem of data being damaged by accidental operation due to indiscriminate synchronization in the prior art, as well as the deep-seated technical defect that the protection system is easily bypassed by a single protection rule (e.g., by deleting the parent directory), thus achieving the comprehensive technical effect of constructing a comprehensive and robust data security protection system that can flexibly respond to complex protection needs, has self-defense capabilities, and is not easily circumvented.

[0079] For example, the following specific example illustrates the folder mounting method provided in the above embodiments.

[0080] This example provides a folder mounting system based on the folder mounting method described in the above embodiments. The structural block diagram of the system is as follows. Figure 2 As shown, it is mainly divided into four modules: rule generation module, difference comparison module, difference filtering module, and file synchronization module.

[0081] The rule generation module is responsible for generating a rule list based on the user's folder protection policy. During folder synchronization, the difference comparison module compares the contents of the temporary image and the mounted folder to generate a difference list. Then, the difference filtering module filters the difference list according to the rule list to generate a synchronization list. Finally, the file synchronization module synchronizes each item in the synchronization list to the mounted folder, completing the folder synchronization. The functions of each module will be described below.

[0082] The rule generation module is responsible for generating the rule list. The rule list consists of a series of rule items, where each rule item defines all protection policies within a specific path in the mounted folder. The rule list is stored in a JSON structure, as follows:

[0083]

[0084] Protection rules are stored as a JSON array, with each member corresponding to a rule item. Each rule item is stored as a JSON object, where `Scope` indicates the scope of the rule item's effect, and its value is the specific path within the mounted folder, where the mounted folder is the root of the path. The `Rules` array contains all rules for this rule item. Each rule is a JSON object, with the following structure:

[0085]

[0086] RuleType specifies the rule type, with two options: NoModification (meaning it cannot be modified / deleted) and NoCreation (meaning it cannot be created). Regex is the matching expression used to match the filename of the rule to be executed, expressed using regular expressions.

[0087] For example, regarding the directory structure, if the user-defined protection rules are: dir3 cannot be deleted; no new files can be created in dir3; all files prefixed with "file" cannot be deleted in dir4; and no new files prefixed with "test" can be created in dir4, the specific directory structure would be:

[0088]

[0089] Based on the user-defined protection rules, the generated rule content is as follows:

[0090]

[0091] It's important to note that directories corresponding to the Scope members of a rule item, as well as all their ancestor directories, cannot be deleted by default. For example, in the rule items corresponding to rules 3) and 4) mentioned above, if the Scope member is / dir1 / dir4, then / , / dir1, and / dir1 / dir4 cannot be deleted.

[0092] The difference comparison module is responsible for comparing the contents of the mounted folder and the temporary image, generating a difference list. This module parses the image file according to the file system format of the temporary image, compares the parsed results with the files at the corresponding paths in the mounted folder one by one, and generates a difference list. The difference list stores all modifications made by the host to the mounted folder. The difference list is stored in a JSON structure, as follows:

[0093]

[0094] The difference list is represented using a JSON array, where each member corresponds to a difference item. Each difference item is stored using a JSON object, where File is the file path corresponding to the difference item. Operation represents the operation performed on the file corresponding to File, and there are three operation types: Create (create), Modify (modify), and Delete (delete).

[0095] The difference filtering module is responsible for filtering all difference items in the difference list using a rule list, generating a synchronization list. The synchronization list stores all changes that ultimately need to be synchronized to the mounted folder, represented using a JSON array. The JSON representation format of the synchronization items is consistent with that of the difference items. The filtering process is as follows: Figure 3 As shown, the specific process includes the following:

[0096] The process begins with the difference filtering module receiving two key inputs: a complete list of differences and a list of preset rules.

[0097] The module begins processing each difference item in the difference list one by one. This can be understood as a loop, processing one file change operation in each iteration (such as deleting file A or creating file B) until all differences have been reviewed.

[0098] For the discrepancy being processed, the module iterates through the entire rule list, examining it against each rule. This examination process involves two key, parallel decision-making logics.

[0099] First, there's the regular rule matching:

[0100] The first step is scope determination, which determines whether the file path of the current difference item falls within the scope of a certain rule item.

[0101] The second step is rule matching. If the path matches, the `Rules` array under that rule is traversed. The `Operation` and `filename` of the difference item are checked to see if they simultaneously satisfy the `RuleType` and `Regex` of a specific rule. For example, a difference item with `Operation Delete` is considered to violate the rule if its filename matches a rule with `RuleType` of `NoModification`.

[0102] Secondly, there is special rule matching (i.e., ancestor directory protection):

[0103] If the current difference item's Operation is Delete, the module performs an additional check: it determines whether the deleted file path is a directory defined by the Scope of any rule item in the rule list, or any parent (ancestor) directory of those Scope directories. According to the technical disclosure, these directories are protected by default and cannot be deleted.

[0104] After applying all rules to a discrepancy, the module makes a decision: if the discrepancy is deemed to violate a protection rule at any of the above evaluation steps, it will be discarded and not added to the final synchronization list. If the discrepancy passes all rule reviews and does not trigger any violations, it will be considered a safe operation and added to the synchronization list.

[0105] Once all differences in the difference list have been processed, the outer loop ends. At this point, the module has generated a complete synchronization list containing only allowed synchronization operations and outputs it to the next module, the file synchronization module.

[0106] The file synchronization module is responsible for updating all synchronization items in the synchronization list to the mounted folder. The update process is as follows: Figure 4 As shown, the specific process includes the following:

[0107] The process begins with the file synchronization module receiving the synchronization list as its sole input data.

[0108] The module begins processing each synchronization item in the synchronization list one by one. This can be viewed as a loop, with each iteration executing a specific file synchronization task.

[0109] For the currently processed synchronization item, the module reads the value of its Operation field and performs corresponding, immutable file system operations based on this value, as follows:

[0110] If Operation is Create, the module will create a new file or directory in the client's mounted folder, according to the path specified by the File field of the synchronization item. When creating a new file, its contents will be copied from the corresponding file in the temporary image.

[0111] If the Operation is Modify, the module will copy the modified files in the temporary image to the corresponding path in the client's mounted folder, overwriting the original old files, thus completing the content update.

[0112] If Operation is Delete, the module will permanently delete the corresponding file or directory in the client's mounted folder, according to the path specified by the File field of the synchronization item.

[0113] Once all synchronization items in the synchronization list have been successfully executed, the loop ends, meaning all safe changes have been applied to the original mounted folder. As the final step in the entire folder mounting lifecycle, this module (or its caller) is responsible for deleting the temporary image used for this mount, completing all cleanup work, and the entire synchronization process ends here.

[0114] In summary, the folder mounting system in this example provides a folder mounting solution that can protect files, solving the problem of accidental operation on the original mounted folder during synchronization. The file protection solution can be flexibly configured using protection rules, enabling fine-grained file protection strategies. The protection rules use JSON format, which is easy to read and write, and easy to parse during code implementation, making it convenient to operate.

[0115] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0116] Embodiments of this application also provide a folder mounting device, which is applied to a computer system including a client and a server. The client provides the source folder to the server for access as a temporary mirror through a mounting operation. The device is executed by the client, and its structure is as follows: Figure 5 The above includes:

[0117] The comparison module 501 is used to compare the temporary image with the source folder in response to the received command to disconnect the temporary image mount, and generate a difference list; the difference list is used to characterize the file change operations that have occurred in the temporary image;

[0118] The filtering module 502 is used to filter the difference list to exclude change operations in the difference list that do not conform to the preset file protection policy and generate a synchronization list.

[0119] Synchronization module 503 is used to perform synchronization on the source folder according to the synchronization list, so as to apply the file change operations contained in the synchronization list.

[0120] For a description of the features in the embodiment corresponding to the folder mounting device, please refer to the relevant description in the embodiment corresponding to the folder mounting method, which will not be repeated here.

[0121] Embodiments of this application also provide an electronic device, such as... Figure 6 As shown, it includes a memory 10 and a processor 20. The memory 10 stores a computer program, and the processor 20 is configured to run the computer program to perform the steps in any of the above-described folder mounting method embodiments.

[0122] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described folder mounting method embodiments when it runs.

[0123] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0124] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described folder mounting method embodiments.

[0125] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described folder mounting method embodiments.

[0126] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0127] The foregoing has provided a detailed description of a folder mounting method, system, apparatus, device, medium, and program product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for mounting a folder, characterized in that, The method is applied to a computer system including a client and a server. The client provides the source folder to the server as a temporary mirror through a mount operation. The method is executed by the client and includes: In response to the received instruction to disconnect the temporary image mount, the temporary image is compared with the source folder, and a difference list is generated; the difference list is used to characterize the file change operations that have occurred in the temporary image; The difference list is filtered to exclude change operations that do not conform to the preset file protection policy, and a synchronization list is generated. Synchronize the source folder according to the synchronization list to apply the file change operations contained in the synchronization list.

2. The method according to claim 1, characterized in that, The preset file protection strategy includes at least one rule item; the rule item is used to characterize the protection rules for a specific path range within the source folder.

3. The method according to claim 2, characterized in that, The protection rules include rule types and matching expressions used to match filenames.

4. The method according to claim 3, characterized in that, The rule types include: a first rule type that prohibits modifying or deleting files, and a second rule type that prohibits creating files; the matching expression is a regular expression.

5. The method according to claim 4, characterized in that, The file change operations in the difference list include at least one of the following: creation, modification, and deletion operations.

6. The method according to claim 5, characterized in that, The preset file protection strategy, the difference list, and the synchronization list are all stored and represented in JSON format.

7. The method according to any one of claims 1 to 6, characterized in that, Filtering the difference list includes: For any change operation in the difference list, determine whether the operation type and file name of the change operation match the rule type and matching expression of any protection rule; if they match, the change operation is considered to be inconsistent with the preset file protection strategy. If the change operations in the difference list include a deletion operation targeting the target directory, then it is determined whether the target directory is a specific path range defined in any rule item or an ancestor directory of the specific path range; if so, the deletion operation is considered to be inconsistent with the preset file protection strategy. Exclude all change operations deemed not to comply with the preset file protection policy from the difference list.

8. A folder mounting device, characterized in that, The device is applied to a computer system including a client and a server. The client provides the source folder to the server for access as a temporary mirror through a mount operation. The device is executed by the client and includes: The comparison module is used to compare the temporary image with the source folder in response to a received command to disconnect the temporary image mount, and generate a difference list; the difference list is used to characterize the file change operations that have occurred in the temporary image; The filtering module is used to filter the difference list to exclude change operations in the difference list that do not conform to the preset file protection policy and generate a synchronization list. The synchronization module is used to perform synchronization on the source folder according to the synchronization list, so as to apply the file change operations contained in the synchronization list.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the folder mounting method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the folder mounting method as described in any one of claims 1 to 7.