Folder replication method and apparatus, electronic device, and storage medium

By creating a pointer relationship between the target folder and the source folder, the problem of high latency in folder copying in cloud storage is solved, thus achieving file availability and efficient execution of copying tasks.

CN117251417BActive Publication Date: 2026-05-29BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2023-05-29
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Copying folders in cloud storage, especially for millions of files, can result in high latency and make files unusable, impacting user experience.

Method used

By creating a target folder and establishing a link to the source folder on it, such as a symbolic link, users can access the source folder through the target folder during the copying process, until the link is removed after the copying is complete.

Benefits of technology

This reduces the time spent on file copying, ensuring file availability and improving the efficiency of copying tasks and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117251417B_ABST
    Figure CN117251417B_ABST
Patent Text Reader

Abstract

The present disclosure provides a folder replication method, relates to the technical field of data processing, and particularly relates to a folder replication device, an electronic device and a storage medium. A specific implementation scheme is as follows: in response to a folder replication request, a folder replication task is created; a target folder corresponding to the source folder is created at a target position matched with the folder replication request, and a pointing relationship from the target folder to the source folder is created on the target folder, the pointing relationship being used to point the operation of a user on the target folder to the source folder; the folder replication task is executed to copy the files in the source folder into the target folder, and after the copying is completed, the pointing relationship is cancelled. The present disclosure can guarantee the availability of files in the copying process and avoid the occupation of files in the copying process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to methods, apparatus, electronic devices, and storage media for copying folders. Background Technology

[0002] With the development of cloud storage technology, cloud space provides users with cloud storage services with ultra-large storage space. Therefore, when users copy folders in cloud space, it usually involves millions of full files, which makes the whole operation take a long time and has a high latency. During the folder copying process, in order for the copying task to proceed smoothly, the files in the target folder are usually locked, meaning that these files cannot be operated on. As a result, the files are occupied for a long time, making it impossible for users to use the files. Summary of the Invention

[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for copying folders to solve at least one of the above-mentioned technical problems.

[0004] According to one aspect of this disclosure, a method for copying a folder is provided, the method comprising:

[0005] In response to a folder copy request, create a folder copy task;

[0006] Create a target folder corresponding to the source folder at the target location that matches the folder copy request, and create a pointer relationship on the target folder pointing to the source folder. The pointer relationship is used to direct the user's operation on the target folder to the source folder.

[0007] Execute the folder copy task to copy the files in the source folder to the target folder, and cancel the pointing relationship after the copy is completed.

[0008] According to another aspect of this disclosure, a folder copying apparatus is provided, the apparatus comprising:

[0009] The task creation module is used to create folder copy tasks in response to folder copy requests;

[0010] The pointer relationship creation module is used to create a target folder corresponding to the source folder at a target location that matches the folder copy request, and to create a pointer relationship on the target folder pointing to the source folder. The pointer relationship is used to direct the user's operation on the target folder to the source folder.

[0011] The task execution module is used to execute the folder copying task, copy the files in the source folder to the target folder, and cancel the pointing relationship after the copying is completed.

[0012] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0013] At least one processor; and

[0014] A memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the folder copying method described above.

[0016] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the copying method according to the above-described folder.

[0017] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the folder copying method described above.

[0018] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0019] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0020] Figure 1 This is a flowchart illustrating the folder copying method provided in the first embodiment of this disclosure;

[0021] Figure 2 This is a flowchart illustrating the folder copying method provided in the second embodiment of this disclosure;

[0022] Figure 3 This is a flowchart illustrating the steps for protecting copied files in the folder copying method provided in this publication;

[0023] Figure 4 This is a schematic diagram of the structure of the folder copying device provided in the third embodiment of this disclosure;

[0024] Figure 5 This is a block diagram of an electronic device used to implement the methods of the embodiments of this disclosure. Detailed Implementation

[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0026] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.

[0027] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0028] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are also intended to include the plural forms, unless the context clearly indicates otherwise.

[0029] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0030] The method for copying the vehicle security asset folder according to this disclosure can be executed by an electronic device such as a terminal device or a server. The terminal device can be an in-vehicle device, user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. The method can be implemented by a processor calling computer-readable program instructions stored in memory. Alternatively, the in-vehicle voice interaction method provided in this disclosure can be executed by a server.

[0031] It should be noted that the folder copying method provided in this disclosure can be executed on a storage server (e.g., in the cloud) or on a local storage device, and is not limited to either.

[0032] In the first disclosed embodiment, see Figure 1 , Figure 1 A flowchart illustrating a folder copying method according to a first embodiment of this disclosure is shown. The method includes:

[0033] S101. In response to the folder copy request, create a folder copy task.

[0034] The folder copy request must contain at least task information, which includes at least: the source folder (the folder to be copied), the target folder (the folder into which the files are copied), and may also include task identification (UserIdentification, UID), task type (e.g., folder copy type), etc.

[0035] Furthermore, to obtain information related to task execution, preset parameters can be added to the task information. These preset parameters include, for example, operation time (the time elapsed during task execution) and task status. A task identifier (TaskID) is then assigned to the folder copy task, and the operation time and task status are added to the task information. A relationship is established between the task identifier and the task information, and the task identifier, task information, and their relationship are recorded in a preset task database table. This allows for subsequent retrieval of the folder copy task's execution information from the task database table.

[0036] The task identifier for the folder copy task is a globally unique identifier. Throughout the copying process, the folder copy task has only one task identifier. By binding the task information with the task identifier and storing it in the task database table, the required task information can be retrieved through the task identifier.

[0037] S102. Create a target folder corresponding to the source folder at the target location that matches the folder copy request, and create a pointer relationship between the target folder and the source folder on the target folder.

[0038] This method describes the copying process of copying files from the source folder to the target folder. The target location in S102 is the location selected by the user to store the newly copied folder (target folder).

[0039] The pointing relationship is used to direct user operations on the target folder to the source folder.

[0040] Furthermore, in some examples, the pointing relationship is represented as a symbolic link. Specifically, creating a pointing relationship from the target folder to the source folder on the target folder in S102 includes:

[0041] Create a symbolic link on the target folder that points to the source folder.

[0042] A soft link is a symbolic link that contains path information to the object it points to (the source folder). Deleting a soft link does not affect the folder it points to.

[0043] In this way, at the beginning of the folder copying task, a target folder corresponding to the copied state is created at the target location, and the target folder is linked to the source folder. Thus, during the execution of the folder copying task, if the user wants to view the copied files in the target folder, in other words, if the user performs file operations on the target folder, the file operation can be directed to the source file, and the source file can call the target file corresponding to the file operation for the user to view.

[0044] S103. Execute the folder copy task, copy the files in the source folder to the target folder, and remove the pointer relationship after the copy is completed.

[0045] This approach creates a target folder that points to the source folder, allowing users to navigate to the source folder and view the files to be copied during the copying process. This ensures file availability and prevents the copying process from consuming files.

[0046] In the disclosed second embodiment, see Figure 2 , Figure 2 A flowchart illustrating a folder copying method according to a second embodiment of this disclosure is shown. The method includes:

[0047] S201. In response to the folder copy request, generate a folder copy task based on the task information contained in the folder copy request.

[0048] The task information includes at least the source folder and the target folder, and may also include information such as the task identifier and task type. The task identifier is the UID corresponding to the folder copy operation included in the folder copy request; the task type is, for example, "folder copy"; the source file is the folder to be copied; and the target folder is the folder into which the file will be copied in this task.

[0049] S202. Assign a task identifier to the folder copying task, add the operation time and task status to the task information, and establish the association between the task identifier and the task information.

[0050] The task status is one of the following: initial task status (i.e., the state when the folder copying task has just been generated and has not yet been executed), task in execution status, task execution failed status, or task execution completed status (all tasks have been completed).

[0051] S203. Record the task identifier, task information, and their relationship into the preset task database table.

[0052] To obtain information about task execution, preset parameters can be added to the task information. These preset parameters may include, for example, operation time (the time elapsed during task execution) and task status. Then, a task identifier is assigned to the folder copy task, and the operation time and task status are added to the task information. The task identifier and task information are then linked; in other words, a relationship is established between the task identifier and task information. The task identifier, task information, and the relationship between them are recorded in a preset task database table, allowing for subsequent retrieval of folder copy task execution information from the task database table.

[0053] The task identifier for the folder copy task is a globally unique identifier. Throughout the copying process, the folder copy task has only one task identifier. By binding the task information with the task identifier and storing it in the task database table, the required task information can be retrieved through the task identifier.

[0054] S201-S203 are one implementation of S101. S101 can also be implemented in other ways, which are not limited here.

[0055] S204. Create a target folder corresponding to the source folder at the target location that matches the folder copy request, and create a pointer relationship from the target folder to the source folder on the target folder.

[0056] The pointing relationship is used to direct user operations on the target folder to the source folder.

[0057] Furthermore, in some examples, the pointing relationship is represented as a symbolic link. Specifically, creating a pointing relationship from the target folder to the source folder on the target folder in S102 includes:

[0058] Create a symbolic link on the target folder that points to the source folder.

[0059] A soft link is a symbolic link that contains path information to the object it points to (the source folder). Deleting a soft link does not affect the folder it points to.

[0060] In this way, at the beginning of the folder copying task, a target folder corresponding to the copied state is created at the target location, and the target folder is linked to the source folder. Thus, during the execution of the folder copying task, if the user wants to view the copied files in the target folder, in other words, if the user performs file operations on the target folder, the file operation can be directed to the source file, and the source file can call the target file corresponding to the file operation for the user to view.

[0061] S205. Set the target folder's folder status to "copy incomplete".

[0062] The folder status can be either "copy incomplete" or "copy complete". After creating the folder copy task, the target folder's status is initially set to "copy incomplete". During task execution, the task status is periodically checked according to a preset cycle. When a "task completion" status (all tasks are complete) is detected, the target folder's status is changed to "copy complete".

[0063] The duration of the preset period can be set arbitrarily according to the specific implementation method, for example, it can be set to 10ms.

[0064] In some examples, following S205, the folder copying method provided in this disclosure also includes:

[0065] Step 1: In response to file viewing operations on the target folder and any item in any file within the target folder, determine the folder status of the target folder.

[0066] Step 2: If the folder status is confirmed to be incomplete copying, point the file viewing operation to the source folder according to the pointing relationship, and identify the target file in the source folder that corresponds to the file viewing operation.

[0067] Step 3: Perform file viewing operations on the target file.

[0068] In an embodiment where the folder status of the target folder is set, if a user sends a file viewing operation targeting the target folder or any file within the target folder, i.e., the copying task has been completed based on the folder status or whether the current folder copying task has been completed, if the copying task has not been completed (i.e., the folder status is "copying incomplete"), the system jumps to the source folder via a pointer relationship to determine the target file in the source folder corresponding to the file viewing operation, and then performs the file viewing operation on the target file. If the copying task has been completed (i.e., the folder status is "copying complete"), the system directly views the file corresponding to the file viewing operation in the target folder. In this way, the completion status of the folder copying task can be determined directly through the folder status without querying the task database table, thereby reducing the amount of data processing.

[0069] It should be noted that steps one through three can be executed at any time after S204, and there is no restriction on the execution order.

[0070] S206. Divide the multiple sub-file objects contained in the source folder into multiple object groups.

[0071] S207. Generate multiple asynchronous folder copying subtasks for multiple object groups respectively.

[0072] When the source folder contains a large number of subfile objects (which can be at least one of subfolders or files), such as millions of subfile objects, multiple subfile objects can be divided into multiple object groups, and an asynchronous folder copying subtask can be generated for each object group.

[0073] S208. Execute multiple asynchronous folder copying subtasks sequentially, and update the task status of the folder copying task in the task database table according to the execution progress.

[0074] An execution queue is generated based on multiple asynchronous folder copying subtasks. The multiple asynchronous folder copying subtasks are executed sequentially according to the order of the execution queue and in an asynchronous manner. By copying in batches, task blocking can be reduced and the reliability of task execution can be improved.

[0075] Furthermore, during the execution of multiple asynchronous folder copying subtasks, the task status of the folder copying task in the task database table is updated according to the execution progress. Specifically, S208 includes any of the following execution methods:

[0076] Method 1: Execute multiple asynchronous folder copying subtasks sequentially and change the task status to "task in progress".

[0077] Method 2: If multiple asynchronous folder copy subtasks have completed execution, change the task status to "all tasks completed".

[0078] Method 3: If any asynchronous folder copy subtask fails to execute, change the task status to "Task Execution Failed".

[0079] If any asynchronous folder copying subtask fails during execution, the task status in the task database table will be changed to "task execution failed" before the task exits. Furthermore, the task database table will record the target asynchronous folder copying subtask corresponding to the task interruption point in the task information based on the execution queue. This allows the failed target asynchronous folder copying subtask to be restarted using the task execution failure status and the task interruption point. In this way, the success rate of task execution is improved, and data consistency is ensured after file copying failures.

[0080] S209. After detecting that the task status of the folder copying task is "all tasks completed", cancel the pointing relationship.

[0081] The task database table is called periodically to check the task status of the current folder copying task. Once the task status is confirmed as "all tasks completed," the copying is deemed complete, and the pointer relationship to the target folder can be cancelled. This allows subsequent operations on the target folder to be performed normally. This step ensures that the pointer relationship becomes invalid after the task is completed. In embodiments where the pointer relationship is a symbolic link, cancelling the pointer relationship specifically involves deleting the symbolic link.

[0082] The duration of the preset period can be set arbitrarily according to the specific implementation method, for example, it can be set to 20ms.

[0083] Specifically, S206-S209 is one implementation of S102. S102 also has other implementations, which are not limited here. Furthermore, when the source folder contains a large number of sub-file objects, it can be executed according to S206-S209. When the source folder contains a small number of sub-file objects, S206-S209 can be omitted, and all sub-file objects to be copied can be packaged into a single task for execution.

[0084] S210. Delete the task identifier, task information, and association relationships of the folder copy task from the task database table.

[0085] Once the task execution is confirmed to be complete—in other words, once the task status of the folder copy task is detected as "all tasks completed"—the task identifier, task information, and associations of the folder copy task are deleted from the task database table. This reduces redundant information in the task database table and prevents completed folder copy tasks from being accidentally triggered.

[0086] S211. Set the folder status of the target folder to copy complete.

[0087] Once the task execution is confirmed to be complete, in other words, after the task status of the folder copying task is detected to be "all tasks completed", the folder status of the target folder is set to "copy completed". Thus, when the task execution is complete (i.e. the folder status is "copy completed"), operations on the target folder are directly performed on the target folder, and changes can be made to both the target folder and the source folder.

[0088] It should be noted that the execution order of S210 and S211 can be interchanged, and no restriction is made here.

[0089] Based on the above, this disclosure also establishes an exception handling mechanism for task abnormalities during the execution of a folder copying task. Specifically, based on the above-mentioned method three, S208, it also includes:

[0090] Step 1: Check the task status according to the preset cycle.

[0091] The duration of the preset period can be set arbitrarily according to the specific implementation method, for example, 15ms. The purpose of step one is to set a periodic anomaly detection cycle to check the task status and detect task anomalies in a timely manner.

[0092] Step 2: Based on the task status detection, perform the corresponding task processing operations for the folder copying task.

[0093] Multiple sets of matching relationships between detection conditions and task processing operations can be preset. The detection conditions include one of the following: the task status is detected as a task execution failure state, or the operation time of any asynchronous folder copying subtask exceeds a preset threshold. The task processing operations include one of the following: the task interruption point is determined and the target asynchronous folder copying subtask is restarted, or the asynchronous folder copying subtask whose operation time exceeds the preset threshold is restarted.

[0094] Specifically, in some examples, step two includes the following sub-steps:

[0095] Sub-step A: If the task status is detected as a task execution failure, determine the task interruption point.

[0096] Sub-step 2A: Determine the target asynchronous folder corresponding to the task interruption point, copy the sub-task, and restart the target asynchronous folder copy sub-task.

[0097] According to method three in S208, if any asynchronous folder copying subtask fails during execution, the task status of the folder copying task in the task database table will be changed to a task execution failure status before the task exits. Furthermore, the task database table will record the target asynchronous folder copying subtask corresponding to the task interruption point in the task information of the folder copying task according to the execution queue. Thus, in sub-steps A and B, if a task status of task execution failure is detected, the task interruption point can be determined through the task database table, and the failed folder copying subtask can be identified as the target asynchronous folder copying subtask through the task endpoint. Then, the failed target asynchronous folder copying subtask will be restarted.

[0098] Alternatively, step two may include the following sub-steps:

[0099] Sub-step B: If the operation time of any asynchronous folder copying subtask exceeds a preset threshold, interrupt the asynchronous folder copying subtask whose operation time exceeds the preset threshold.

[0100] Sub-step 2B: Restart the asynchronous folder copying subtask whose operation time exceeds the preset threshold.

[0101] The preset threshold is a reference time for determining when a task is stuck. It can be set according to specific implementation requirements, for example, it can be set to 1 minute.

[0102] In some cases, asynchronous folder copying subtasks may exit abnormally without changing the task status to "task execution failed." In such cases, the task status remains "task execution in progress," causing the exception to go undetected. Therefore, a preset threshold for the exception period can be set. By checking the operation time of the current task in the task data table, if the operation time exceeds the preset threshold, it can be determined that the task has encountered an exception. This triggers an interruption operation on the current asynchronous folder copying subtask, changing the task status to "task execution failed," thereby triggering a restart mechanism to restart asynchronous folder copying subtasks whose operation time exceeds the preset threshold.

[0103] By using the above methods, task anomalies can be detected and intervened in a timely manner, ensuring the success rate of replication tasks and data consistency.

[0104] It should be noted that steps one and two can be executed at any time during the entire process after S207 and before S209 (specifically, they can be executed periodically according to a preset cycle), and there are no restrictions here.

[0105] Based on the above, this disclosure also establishes a mechanism to protect the file integrity of the source and target folders during the execution of a folder copying task. Specifically, see [link to documentation]. Figure 3 , Figure 3 This flowchart illustrates the steps for protecting copied files in the folder copying method provided in this disclosure. Based on the folder state setting embodiment in S205 above, the folder copying method provided in this disclosure further includes:

[0106] S201' In response to a file change operation on any of the following: source folder, any file in the source folder, target folder, or any file in the target folder, determine the folder status of the target folder.

[0107] S202' Determine the execution method for file change operations based on the folder status.

[0108] To protect the integrity of the source folder and its files, as well as the target folder and its files, the status of the target folder can be used to determine whether the copying task has been completed. If the copying task is not completed, operations that would damage the integrity of the source folder and its files (i.e., file modification operations) will not be performed on the source folder and its files, or the target folder and its files. Only viewing operations are allowed. This method protects the integrity of the files, prevents files from being accidentally deleted before the copying task is completed, and improves the reliability of the folder copying method provided in this embodiment.

[0109] Specifically, S202' includes the following situations:

[0110] (1) If the folder status is confirmed to be copied, perform the file change operation.

[0111] If the folder status is detected as "copy complete", the copy task can be considered complete. In this case, the folder is no longer locked, and file modification operations can be performed normally.

[0112] (2) If the folder status is determined to be in an incomplete copying state, determine the execution method of the file change operation according to any of the following.

[0113] Method 1: Disable file modification operations.

[0114] Method 2: Generate an asynchronous file change task based on the file change operation; execute the asynchronous file change task when the folder status is detected as "copy complete".

[0115] If the folder status is detected as "not copied incomplete," meaning the copying task has not been completed, the integrity of the files needs to be protected. This can be achieved by directly prohibiting the operation, or by generating an asynchronous file change task. After generating the asynchronous file change task, its related information can be stored in the aforementioned task database table and queued. When the folder status is detected as "copy completed," the asynchronous file change task is executed according to the queue order, and its related information is deleted from the task database table after execution.

[0116] File modification operations include at least one of the following: deletion operation, transfer operation, etc.

[0117] It should be noted that S201' and S202' can be executed at any time during the file copying process, and there are no restrictions here.

[0118] In the third disclosed embodiment, based on and Figure 1 The same principle, Figure 4 This invention discloses a folder copying apparatus 40 according to a third embodiment of the present invention, the apparatus comprising:

[0119] Task creation module 401 is used to create a folder copy task in response to a folder copy request.

[0120] The pointer relationship creation module 402 is used to create a target folder corresponding to the source folder at the target location that matches the folder copy request, and to create a pointer relationship on the target folder pointing to the source folder. The pointer relationship is used to direct the user's operation on the target folder to the source folder.

[0121] Task execution module 403 is used to perform folder copying tasks, copying files from the source folder to the target folder, and canceling the pointer relationship after the copying is completed.

[0122] The pointer relationship is represented as a symbolic link; the pointer relationship creation module is specifically used for:

[0123] Create a symbolic link on the target folder that points to the source folder.

[0124] In some examples, the task creation module includes:

[0125] The generation submodule is used to generate a folder copy task based on the task information contained in the folder copy request. The task information includes: source folder and target folder.

[0126] The Identifier Assignment Submodule is used to assign task identifiers to folder copy tasks, add operation time and task status to task information, and establish the association between task identifiers and task information.

[0127] The table storage submodule is used to record task identifiers, task information, and their relationship into a preset task database table.

[0128] In some examples, the folder copying task is an asynchronous task; the device also includes:

[0129] The grouping module is used to divide multiple sub-file objects contained in the source folder into multiple object groups;

[0130] The subtask generation module is used to generate multiple asynchronous folder copying subtasks for multiple object groups respectively;

[0131] The subtask execution module is used to execute multiple asynchronous folder copy subtasks sequentially and update the task status of the folder copy tasks in the task database table according to the execution progress.

[0132] The pointer relationship management module is used to cancel the pointer relationship after detecting that the task status of the folder copying task is "all tasks have been completed".

[0133] In some examples, the device also includes:

[0134] The task information deletion module is used to delete the task identifier, task information, and associations of folder copy tasks from the task database table.

[0135] In some examples, the subtask execution module has features for:

[0136] Execute multiple asynchronous folder copying subtasks sequentially and change the task status to "task in progress";

[0137] Alternatively, if multiple asynchronous folder copy subtasks have completed execution, change the task status to "all tasks completed".

[0138] Alternatively, if any asynchronous folder copy subtask fails to execute, change the task status to "Task Execution Failed".

[0139] In some examples, the device also includes:

[0140] The detection module is used to detect the task status according to a preset cycle;

[0141] The processing module is used to perform corresponding task processing operations on the folder copying task based on the task status detection.

[0142] In some examples, the processing module is specifically used for:

[0143] If a task is detected to be in a failed execution state, determine the task interruption point.

[0144] Identify the target asynchronous folder copy subtask corresponding to the task interruption point, and restart the target asynchronous folder copy subtask;

[0145] or,

[0146] If the operation time of any asynchronous folder copying subtask exceeds a preset threshold, the asynchronous folder copying subtask whose operation time exceeds the preset threshold will be interrupted.

[0147] Restart asynchronous folder copying subtasks whose operation time exceeds a preset threshold.

[0148] In some examples, the device also includes:

[0149] The first state module is used to set the folder status of the target folder to an incomplete copy status;

[0150] In some examples, the device also includes:

[0151] The second status module is used to set the folder status of the target folder to the copy completed state.

[0152] In some examples, the device also includes:

[0153] The folder status determination module is used to determine the folder status of the target folder in response to any file change operation on the source folder, any file in the source folder, the target folder, or any file in the target folder.

[0154] The execution method determination module is used to determine the execution method for file change operations based on the folder status.

[0155] In some examples, the execution method determination module is used for:

[0156] Once the folder status is confirmed to be "copy complete", perform the file modification operation;

[0157] Alternatively, if the folder status is determined to be incomplete copying, determine the execution method for the file change operation according to any of the following:

[0158] Do not perform file modification operations;

[0159] or,

[0160] Generate asynchronous file change tasks based on file change operations;

[0161] If the folder status is detected as "copy complete", execute the asynchronous file change task;

[0162] File modification operations include either deletion or transfer.

[0163] In some examples, the device also includes:

[0164] The status determination module is used to determine the folder status of the target folder in response to file viewing operations on the target folder and any item in any file within the target folder.

[0165] The target file determination module is used to determine the target file in the source folder that corresponds to the file viewing operation when the folder status is determined to be in an incomplete copying state.

[0166] The operation execution module is used to perform file viewing operations on the target file.

[0167] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0168] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0169] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0170] like Figure 5 As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 502 or a computer program loaded from storage unit 508 into random access memory (RAM) 503. RAM 503 may also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.

[0171] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0172] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the folder copying method. For example, in some embodiments, the folder copying method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the folder copying method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the folder copying method by any other suitable means (e.g., by means of firmware).

[0173] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0174] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0175] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0176] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0177] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0178] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0179] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0180] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for copying a folder, the method comprising: In response to a folder copy request from the source folder to the target location, create a folder copy task; This includes: generating a folder copying task based on the task information contained in the folder copying request; the task information includes task status, source folder, and target folder, and the task status is recorded in a preset task database table; wherein, the folder copying task is an asynchronous task; Create a target folder corresponding to the source folder at the target location that matches the folder copy request, and create a pointer relationship on the target folder pointing to the source folder. The pointer relationship is used to direct the user's operation on the target folder to the source folder. The folder copying task is executed to copy files from the source folder to the target folder, and the pointing relationship is canceled after the copying is completed. This includes: dividing the multiple sub-file objects contained in the source folder into multiple object groups; generating multiple asynchronous folder copying sub-tasks for each of the multiple object groups; executing the multiple asynchronous folder copying sub-tasks sequentially, and updating the task status of the folder copying task in the task database table according to the execution progress; and canceling the pointing relationship after detecting that the task status of the folder copying task is "all tasks completed".

2. The method according to claim 1, wherein, The pointing relationship is represented as a soft link; Creating a pointer relationship on the target folder pointing to the source folder includes: Create a symbolic link on the target folder pointing to the source folder.

3. The method according to claim 1, wherein, The method of creating a folder copy task in response to a folder copy request also includes: Assign a task identifier to the folder copying task, add the operation time and task status to the task information, and establish the association between the task identifier and the task information; The task identifier, the task information, and the relationship between them are recorded in the preset task database table.

4. The method according to claim 3, wherein, After detecting that the task status of the folder copying task is "all tasks completed" and canceling the pointing relationship, the method further includes: Delete the task identifier, task information, and association relationship of the folder copy task from the task database table.

5. The method according to claim 4, wherein, The step of sequentially executing the plurality of asynchronous folder copying subtasks and updating the task status of the folder copying task in the task database table according to the execution progress includes any one of the following: The multiple asynchronous folder copying subtasks are executed sequentially, and the task status is changed to "task in execution". Once the multiple asynchronous folder copying subtasks have been completed, the task status will be changed to "all tasks completed". If any of the asynchronous folder copying subtasks fails to execute, the task status is changed to a task execution failure status.

6. The method according to any one of claims 4-5, wherein, The step of sequentially executing the plurality of asynchronous folder copying subtasks and updating the task status of the folder copying task in the task database table according to the execution progress further includes: The task status is detected according to a preset cycle; Based on the task status detection, perform corresponding task processing operations on the folder copying task.

7. The method according to claim 6, wherein, The step of performing corresponding task processing operations on the folder copying task based on the task status detection includes: If the task status is detected as a task execution failure state, the task interruption point is determined; Identify the target asynchronous folder copying subtask corresponding to the task interruption point, and restart the target asynchronous folder copying subtask; or, If the operation time of any of the asynchronous folder copying subtasks exceeds a preset threshold, the asynchronous folder copying subtask whose operation time exceeds the preset threshold shall be interrupted. Restart the asynchronous folder copying subtask whose operation time exceeds a preset threshold.

8. The method according to any one of claims 1-5, wherein, The method further includes, after creating a target folder corresponding to the source folder at a target location matching the folder copy request, creating a pointer relationship between the target folder and the source folder on the target folder, and executing the folder copy task to copy the files in the source folder to the target folder, and before canceling the pointer relationship after the copy is completed: Set the folder status of the target folder to "copy incomplete"; The method further includes performing the folder copying task, copying files from the source folder to the target folder, and canceling the pointing relationship after the copying is complete: Set the folder status of the target folder to "copy complete".

9. The method according to claim 8, wherein, The method further includes: In response to a file change operation on any one of the source folder, any file in the source folder, the target folder, or any file in the target folder, determine the folder status of the target folder; Based on the folder status, determine the execution method for the file change operation.

10. The method according to claim 9, wherein, The step of determining the execution method of the file change operation based on the folder status includes: If the folder status is determined to be "copy complete", then the file modification operation is performed. If the folder status is determined to be in an incomplete copying state, determine the execution method of the file change operation according to any of the following: The file modification operation is prohibited. or, An asynchronous file change task is generated based on the file change operation; If the folder status is detected as "copy complete", execute the asynchronous file change task; The file modification operations include either a deletion operation or a transfer operation.

11. The method according to claim 8, wherein, The method further includes creating a target folder corresponding to the source folder at a target location matching the folder copy request, and creating a pointer relationship on the target folder pointing to the source folder, wherein the pointer relationship is used to redirect user operations on the target folder to the source folder. In response to a file viewing operation on the target folder and any item in any file within the target folder, determine the folder status of the target folder; If the folder status is determined to be in an incomplete copying state, the file viewing operation is directed to the source folder according to the pointing relationship, and the target file in the source folder corresponding to the file viewing operation is determined. Perform the file viewing operation on the target file.

12. A folder copying device, the device comprising: The task creation module is used to create folder copy tasks in response to folder copy requests; This includes: a generation submodule, used to generate a folder copy task based on the task information contained in the folder copy request; the task information includes task status, source folder, and target folder, and the task status is recorded in a preset task database table; wherein, the folder copy task is an asynchronous task; The pointer relationship creation module is used to create a target folder corresponding to the source folder at a target location that matches the folder copy request, and to create a pointer relationship on the target folder pointing to the source folder. The pointer relationship is used to direct the user's operation on the target folder to the source folder. The task execution module is used to execute the folder copy task, copying files from the source folder to the target folder, and canceling the pointing relationship after copying is completed. It includes: a grouping module, used to divide multiple sub-file objects contained in the source folder into multiple object groups; a sub-task generation module, used to generate multiple asynchronous folder copy sub-tasks for each of the multiple object groups; a sub-task execution module, used to execute the multiple asynchronous folder copy sub-tasks sequentially, and update the task status of the folder copy task in the task database table according to the execution progress; and a pointing relationship management module, used to cancel the pointing relationship after detecting that the task status of the folder copy task is "all tasks completed".

13. The apparatus according to claim 12, wherein, The pointing relationship is represented by a soft link; the pointing relationship creation module is specifically used for: Create a symbolic link on the target folder pointing to the source folder.

14. The apparatus according to claim 12, wherein, The task information includes: source folder and target folder; The task creation module also includes: The identifier assignment submodule is used to assign a task identifier to the folder copy task, add the operation time and task status to the task information, and establish the association between the task identifier and the task information; The table storage submodule is used to record the task identifier, the task information, and the relationship between the two into the preset task database table.

15. The apparatus according to claim 14, wherein, The device further includes: The task information deletion module is used to delete the task identifier, task information, and association relationship of the folder copy task from the task database table.

16. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.

17. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-11.

18. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-11.