File synchronization method, device and equipment

Automating the file synchronization process through shell scripts and bypy middleware, solving the problems of error-prone, low efficiency and time-consuming in traditional file synchronization methods, and achieving efficient and accurate file synchronization.

CN120295985APending Publication Date: 2025-07-11BEIJING QINGSONG YIKANG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510445128.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

Traditional file synchronization methods are prone to errors, are inefficient and time-consuming. Especially when synchronizing a large number of files, users need to spend a lot of time mechanical download and upload operations.

Method used

Automatically obtain the file list of the target application through shell scripts, identify new file identifiers, and use bypy middleware to achieve file download and upload to the cloud server, supporting automatic and manual scanning modes to reduce human operations.

Benefits of technology

It improves the efficiency and accuracy of file synchronization, reduces human operation time, realizes full process automation, and supports real-time status awareness and notification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295985A_ABST
    Figure CN120295985A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file synchronization method, device and equipment, and the method comprises the steps: obtaining a file identifier in a file list of a target application program based on a shell script if a preset file scanning condition is met at present; wherein the file scanning condition comprises that the current time is preset scanning time, or a file scanning instruction is received; if it is determined that a newly added target file identifier exists in the file identifier according to the historical file identifier obtained last time, storing a target file of the target file identifier based on the shell script; and uploading the target file to a cloud server. In the embodiment of the invention, the file list acquisition of the application program and the downloading of the newly added target file are realized through the shell script, and the file uploading is realized through the electronic equipment, so that the whole file synchronization process does not need manual operation, and the file synchronization efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file synchronization method, device and equipment. Background Art

[0002] With the development of technology, there are more and more places where files can be stored, and with it comes the need for file synchronization. The traditional file synchronization process includes: the user checks whether there is a new file in the application. If so, the user manually downloads the file to the local computer and then uploads the local file to the cloud server.

[0003] In the traditional file synchronization process, users must repeatedly switch between the two interfaces of Baidu Netdisk and Alibaba Cloud OSS, which is not only cumbersome and time-consuming, but also often causes file omissions or wrong transmissions due to human negligence. Moreover, in actual business scenarios, this repetitive manual operation seriously affects work efficiency, especially when a large number of files need to be synchronized, users often need to spend hours on mechanical download and upload operations.

[0004] In summary, traditional file synchronization methods have problems such as being prone to errors, low efficiency, and time-consuming. Summary of the invention

[0005] The present application provides a file synchronization method, device and equipment to solve the problems of error-prone, low efficiency and long time consumption in the file synchronization method in the prior art.

[0006] In a first aspect, an embodiment of the present application provides a file synchronization method, characterized in that the method includes: If the preset file scanning condition is currently met, then based on the shell script, the file identifier in the file list of the target application is obtained; wherein the file scanning condition includes that the current time is the preset scanning time, or that a file scanning instruction is received; If it is determined that there is a newly added target file identifier in the file identifier according to the historical file identifier obtained last time, then based on the shell script, the target file of the target file identifier is saved; The target file is uploaded to the cloud server.

[0007] Furthermore, the target application is Baidu Netdisk.

[0008] Further, the shell script-based method of obtaining the file identifier in the file list of the target application includes: Launch the shell script; Call the bypy middleware based on the shell script, so that the list method of the bypy middleware is used to read the file list of the Baidu Netdisk and obtain the file identifiers in the file list.

[0009] Further, the target files for saving the target file identifiers based on the shell script include: Call the bypy middleware based on the shell script, so that the download method of the bypy middleware is used to download the target file with the target file identifier to a specified local directory.

[0010] Further, the cloud server is Alibaba Cloud OSS.

[0011] Further, uploading the target file to the cloud server includes: Upload the target file to the Alibaba Cloud OSS through an https request.

[0012] Further, the method further includes: Receive the upload return result sent by the cloud server; If the upload return result is upload failure, record the upload failure log and send a real-time message of upload failure to a specified recipient; If the upload return result is upload success, record the upload success log, send a real-time message of upload success to the specified recipient, and delete the saved target file.

[0013] Further, the method further includes: If a file upload instruction carrying other files sent by the cloud server is received, control the target application to save the other files; Add the other file identifiers of the other files to the file list.

[0014] In a second aspect, an embodiment of the present application further provides a file synchronization device, and the device includes: A processing module, configured to, if a preset file scanning condition is currently met, obtain the file identifiers in the file list of the target application based on a shell script; wherein, the file scanning condition includes that the current time is a preset scanning time, or a file scanning instruction is received; if it is determined based on the historical file identifiers obtained last time that there are new target file identifiers among the file identifiers, save the target files with the target file identifiers based on the shell script; A synchronization module, configured to upload the target file to a cloud server.

[0015] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a processor for implementing the steps of the file synchronization method as described in any one of the above when executing a computer program stored in a memory.

[0016] In an embodiment of the present application, if a preset file scanning condition is currently met, based on a shell script, a file identifier in a file list of a target application is obtained; wherein, the file scanning condition includes that the current time is a preset scanning time, or a file scanning instruction is received; if it is determined based on the historical file identifier obtained last time that there is a new target file identifier among the file identifiers, then based on the shell script, the target file corresponding to the target file identifier is saved; and the target file is uploaded to a cloud server. That is to say, in an embodiment of the present application, the acquisition of the file list of the application program and the download of the new target file are realized through the shell script, and the file upload is realized through the electronic device, so that the entire file synchronization process does not require manual operation, reducing the time consumption of file synchronization, improving the efficiency of file synchronization, and at the same time improving the accuracy of file synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] To more clearly illustrate the technical solutions of the present application, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0018] Figure 1 FIG. is a schematic diagram of a file synchronization process provided by an embodiment of the present application; Figure 2 FIG. is a file synchronization flowchart provided by an embodiment of the present application; Figure 3 FIG. is a schematic structural diagram of a file synchronization device provided by an embodiment of the present application; Figure 4 FIG. is a schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts fall within the protection scope of the present application.

[0020] In order to reduce the time consumption of file synchronization and improve the efficiency and accuracy of file synchronization, an embodiment of the present application provides a file synchronization method, device, and equipment.

[0021] In an embodiment of the present application, if the current preset file scanning condition is met, based on a shell script, the file identifier in the file list of the target application is obtained; wherein, the file scanning condition includes that the current time is the preset scanning time, or a file scanning instruction is received; if it is determined based on the historical file identifier obtained last time that there is a new target file identifier in the file identifier, then based on the shell script, the target file corresponding to the target file identifier is saved; and the target file is uploaded to the cloud server. Embodiment

[0022] Figure 1 The figure is a schematic diagram of a file synchronization process provided by an embodiment of the present application, and the process includes: S101: If the current preset file scanning condition is met, based on a shell script, the file identifier in the file list of the target application is obtained; wherein, the file scanning condition includes that the current time is the preset scanning time, or a file scanning instruction is received.

[0023] A file synchronization method provided by an embodiment of the present application is applied to an electronic device, and the electronic device can be a PC, a terminal or a server.

[0024] In an embodiment of the present application, multiple application programs are installed in the electronic device, and there is a target application program among these application programs that can be used to store files. To facilitate synchronizing the files in the application program to the cloud server, a file scanning condition is pre-configured in the electronic device, and when the file scanning condition is met, the electronic device scans the files saved in the application program.

[0025] Among them, the file scanning condition can be a timed scan or a manual scan. For example, a timed scan task is configured in the electronic device. If the current time is the preset scanning time, it is considered that the current preset file scanning condition is met; or, the electronic device receives a file scanning instruction.

[0026] If the current preset file scanning condition is met, the electronic device starts the shell script. Among them, to avoid repeated startup, after determining that the current preset file scanning condition is met, the electronic device will determine whether there is a target process in the names of the processes being executed that contains the name of the shell script. If there is no such target process, the electronic device starts the shell script; if there is such a target process, the electronic device does not start the shell script.

[0027] Among them, the shell script is a script program written in shell and has the characteristic of cross-platform.

[0028] In an embodiment of the present application, the electronic device reads a file list of a target application based on a shell script and loads the file list into memory. Among them, the file list includes file identifiers of each file stored in the target application.

[0029] S102: If it is determined according to the historical file identifiers obtained last time that there are new target file identifiers among the file identifiers, then based on the shell script, save the target files of the target file identifiers; upload the target files to the cloud server.

[0030] The electronic device also stores a historical file list downloaded during the previous scan. The historical file list stores historical file identifiers, and the historical file identifiers represent the files that already existed in the target application during the previous scan.

[0031] Based on this, the electronic device can determine the new target file identifiers in the target application during the time period from the previous scan to the current scan according to the historical file identifiers obtained from the previous scan and the file identifiers obtained from the current scan.

[0032] Specifically, the number of historical file identifiers obtained by the electronic device is one or more, and the number of file identifiers obtained is also one or more. The electronic device compares the historical file identifiers with the file identifiers, identifies the file identifiers not included in the historical file identifiers, and determines the file identifiers as the new target file identifiers, and at the same time determines the files corresponding to the target file identifiers as the new target files.

[0033] In another possible implementation, the file list also stores the save time corresponding to each file identifier. The electronic device can determine the file identifiers in the file list whose save time is between the two scan times according to the time of the previous scan and the time of the current scan, and determine the file identifiers as the new target file identifiers.

[0034] After determining the new target file identifiers, the electronic device downloads and saves the target files of the target file identifiers from the target application to the local based on the shell script.

[0035] After completing the download and save of the target files, the electronic device immediately starts the file upload process and uploads the target files to the cloud server through a secure network connection.

[0036] In the implementation of the present application, during the entire file synchronization process, the electronic device automatically maintains a record of the transmission status to ensure that each step can be traced.

[0037] In the embodiments of the present application, the file list of the application program is obtained through a shell script, and the newly added target files are downloaded, and file uploading is implemented through an electronic device, so that the entire file synchronization process does not require manual operation, improving the efficiency and accuracy of file synchronization. Embodiment

[0038] In order to automatically scan for new files in Baidu Netdisk and automatically download them, based on the above embodiments, in the embodiments of the present application, the target application program is Baidu Netdisk.

[0039] In the embodiments of the present application, the target application program can be Baidu Netdisk or other programs that can store files.

[0040] In order to automatically scan for new files in Baidu Netdisk and automatically download them, based on the above embodiments, in the embodiments of the present application, the obtaining of the file identifiers in the file list of the target application program based on the shell script includes: Start the shell script; Based on the shell script, call the bypy middleware, so that the file list of the Baidu Netdisk is read through the list method of the list in the bypy middleware, and the file identifiers in the file list are obtained.

[0041] If the target application program is Baidu Netdisk, the electronic device calls the bypy middleware of Baidu Netdisk based on the shell script, where the bypy middleware is a tool for managing Baidu Netdisk under the command line, which allows users to perform operations such as uploading, downloading, and synchronizing between local files and Baidu Cloud Disk through simple commands.

[0042] Specifically, the shell script first calls the bypy middleware of Baidu Netdisk, and reads the file list of Baidu Netdisk through the list method of the bypy middleware to obtain the file identifiers in the file list.

[0043] Among them, NDJSON format streaming transmission can be adopted. In order to improve the parsing efficiency, the compiled text processing tool awk is used for field extraction, and regular expressions are used to process complex file names. Embodiment

[0044] In order to automatically scan for new files in Baidu Netdisk and automatically download them, based on the above embodiments, in the embodiments of the present application, the saving of the target files with the target file identifiers based on the shell script includes: Based on the shell script, call the bypy middleware, so that the target files with the target file identifiers are downloaded to the local specified directory through the download method of the bypy middleware.

[0045] In the embodiment of the present application, if the target application is Baidu Netdisk, the electronic device also implements file download based on the bypy middleware.

[0046] Specifically, the electronic device calls the bypy middleware based on a shell script, so that the target file identified by the target file is downloaded to a specified local directory through the download method of the bypy middleware.

[0047] Among them, in the embodiment of the present application, if the memory of the target file is too large, a chunked download method can also be adopted.

[0048] In addition, to ensure the security of file download, the target file can be encrypted with a key before download, and then the electronic device decrypts the downloaded file with the corresponding key. Embodiment

[0049] To automatically scan for new files in Baidu Netdisk and automatically download them, and automatically upload them to Alibaba Cloud OSS, based on the above embodiments, in the embodiment of the present application, the cloud server is Alibaba Cloud OSS.

[0050] In the embodiment of the present application, the cloud server can be Alibaba Cloud OSS, or other servers that can store files, such as Tencent Cloud Object Storage (COS), Huawei Cloud Object Storage Service (OSS), Baidu Cloud OSS, etc.

[0051] To automatically scan for new files in Baidu Netdisk and automatically download them, and automatically upload them to Alibaba Cloud OSS, based on the above embodiments, in the embodiment of the present application, uploading the target file to the cloud server includes: Uploading the target file to the Alibaba Cloud OSS through an https request.

[0052] In the embodiment of the present application, the electronic device uploads the target file to the Alibaba Cloud OSS through an https request.

[0053] Exemplarily, the electronic device establishes a secure connection with Alibaba Cloud OSS through the HTTPS protocol and uses the Transport Layer Security (TLS) protocol to encrypt the transmission channel to ensure the integrity and confidentiality of data during transmission. The electronic device first completes authentication through a pre-signed uniform resource locator (URL) or a Security Token Service (STS) temporary authorization credential, and then splits the target file into multiple data blocks according to the shard upload specification of Alibaba Cloud OSS, and improves the upload efficiency through multi-threaded concurrent transmission.

[0054] Each data packet will be attached with a Message-Digest Algorithm (MD5) check value, and Alibaba Cloud OSS will automatically perform data consistency verification when receiving. During the file upload process, the breakpoint resumption mechanism of Alibaba Cloud OSS will automatically record the transmitted progress. When the network is abnormally interrupted, the transmission can be automatically resumed from the position of the last successfully uploaded shard. After the file is successfully written to the Alibaba Cloud OSS bucket, the system will trigger a callback notification, return metadata such as the storage path and file ETag to the preset terminal callback address, and automatically activate the configured subsequent processing processes (such as image processing, transcoding service, or CDN cache refresh, etc.). Embodiment

[0055] In order to realize real-time perception of the download and upload status, on the basis of the above embodiments, in the embodiments of the present application, the method further includes: Receiving the upload return result sent by the cloud server; If the upload return result is upload failure, record the upload failure log and send a real-time message of upload failure to the specified recipient; If the upload return result is upload success, record the upload success log, send a real-time message of upload success to the specified recipient, and delete the saved target file.

[0056] In the embodiments of the present application, after the electronic device uploads the target file to the cloud server, the cloud server will feedback the upload return result to the electronic device, and the upload return result includes but is not limited to upload success or upload failure.

[0057] If the upload return result returned by the cloud server is upload failure, the electronic device records the upload failure log and sends a real-time message of upload failure to the specified recipient. Among them, the electronic device can send the real-time message of upload failure to the specified recipient by means of text message, email, DingTalk, WeChat, etc.

[0058] If the upload return result is successful, record the successful upload log, send a real-time message of successful upload to the specified recipient, and delete the saved target file. Among them, the electronic device can send a real-time message of successful upload to the specified recipient through SMS, email, DingTalk, WeChat, etc. Embodiment

[0059] To achieve file synchronization, based on the above embodiments, in the embodiments of the present application, the method further includes: If a file upload instruction carrying other files sent by the cloud server is received, control the target application to save the other files; Add an other file identifier of the other file to the file list.

[0060] In the embodiments of the present application, the electronic device can also synchronize the files saved in cloud servers such as Alibaba Cloud OSS, Tencent Cloud COS, Huawei Cloud OSS, and Baidu Cloud OSS to a target application such as Baidu Netdisk.

[0061] Specifically, if the electronic device receives a file upload instruction carrying other files sent by the cloud server, the electronic device controls the target application to save the other files based on a shell script; add an other file identifier of the other file to the file list.

[0062] In addition, the electronic device can also monitor the newly added files in the cloud server based on a shell script. After identifying that there are newly added files in the cloud server, automatically start the file synchronization process.

[0063] Figure 2 The file synchronization flow chart provided for the embodiments of the present application is as Figure 2 shown, and this process includes: 1. Set a scheduled task to automatically start or manually start the shell script. First, determine whether there is an execution process with the name of the shell script among the process names being executed in the electronic device. If it exists, it is being executed. If it is being executed, this execution ends.

[0064] 2. Based on the shell script, call the list method of the bypy middleware to read the Baidu Netdisk file list and load it into memory. Loop to determine whether there are new files. If there are new files, call the download method of the bypy middleware to download the new files to the local specified directory, and record the log of whether the download fails or succeeds.

[0065] 3. After the download is successful, read the local file and automatically upload the local file to Alibaba Cloud OSS through an https request, and receive the upload return result of Alibaba Cloud OSS.

[0066] 4. If the upload fails, record the upload failure log and send real-time messages (text messages, emails, DingTalk, WeChat) about the upload failure to the designated recipients.

[0067] 5. If the upload is successful, record the upload success log, send real-time messages (text messages, emails, DingTalk, WeChat) about the upload success to the designated recipients, and then delete the local file.

[0068] 6. When the loop of uploading new files read from Baidu Netdisk this time is completed, the script execution ends.

[0069] Compared with the traditional method of file synchronization based on manual operation, the embodiments of this application have the following advantages 1. Integrity: The embodiments of this application are a complete process of synchronizing files from Baidu Netdisk to Alibaba Cloud OSS. The whole process is automated without manual operation and supports automatic scanning and manual scanning. Automatic scanning: The script is started regularly to scan Baidu Netdisk, and newly added files are automatically downloaded and synchronized. Manual scanning: The script is started manually to scan Baidu Netdisk, and newly added files are automatically downloaded and synchronized.

[0070] 2. In terms of time: The embodiments of this application automatically download and upload, which saves more time than downloading and uploading manually separately.

[0071] 3. In terms of perception: The embodiments of this application send real-time message notifications after automatic upload is completed, and can perceive the upload status in real time.

[0072] 4. In terms of space: After the automatic upload is completed in the embodiments of this application, the files downloaded to the local are deleted, and there is no limitation on the size of the local disk when synchronizing a large number of files.

[0073] 5. In terms of network resources: In the embodiments of this application, after synchronizing a new file, the next new file is synchronized immediately, and the network resource utilization rate is relatively high. Embodiment

[0074] Based on the above embodiments, in the embodiments of this application, Figure 3 FIG. is a schematic structural diagram of a file synchronization device provided by an embodiment of this application. The device includes: A processing module 301, configured to, if the current preset file scanning condition is met, obtain the file identifiers in the file list of the target application program based on a shell script; wherein, the file scanning condition includes that the current time is the preset scanning time, or a file scanning instruction is received; if it is determined based on the historical file identifiers obtained last time that there are new target file identifiers among the file identifiers, save the target files corresponding to the target file identifiers based on the shell script; A synchronization module 302, configured to upload the target files to a cloud server.

[0075] In a possible implementation manner, the target application is Baidu Netdisk.

[0076] In a possible implementation manner, the processing module 301 is specifically configured to start a shell script; call the bypy middleware based on the shell script, so as to read the file list of the Baidu Netdisk through the list method of the bypy middleware, and obtain the file identifiers in the file list.

[0077] In a possible implementation manner, the processing module 301 is specifically configured to call the bypy middleware based on the shell script, so as to download the target file with the target file identifier to a local specified directory through the download method of the bypy middleware.

[0078] In a possible implementation manner, the cloud server is Alibaba Cloud OSS.

[0079] In a possible implementation manner, the synchronization module 302 is specifically configured to upload the target file to the Alibaba Cloud Object Storage Service OSS through an https request.

[0080] In a possible implementation manner, the processing module 301 is further configured to receive an upload return result sent by the cloud server; if the upload return result is upload failure, record an upload failure log, and send a real-time message of upload failure to a specified recipient; if the upload return result is upload success, record an upload success log, send a real-time message of upload success to the specified recipient, and delete the saved target file.

[0081] In a possible implementation manner, the synchronization module 302 is further configured to, if receiving a file upload instruction carrying other files sent by the cloud server, control the target application to save the other files; add other file identifiers of the other files to the file list. Embodiment

[0082] Based on the above embodiments, an embodiment of the present application further provides an electronic device. Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present application is shown in Figure 4 As shown, it includes: a processor 41, a communication interface 42, a memory 43, and a communication bus 44. Among them, the processor 41, the communication interface 42, and the memory 43 complete mutual communication through the communication bus 44; A computer program is stored in the memory 43. When the program is executed by the processor 41, the processor 41 is caused to execute the following steps: If the current situation meets the preset file scanning conditions, then based on the shell script, obtain the file identifiers in the file list of the target application; wherein, the file scanning conditions include that the current time is the preset scanning time, or a file scanning instruction is received. If it is determined that there are new target file identifiers among the file identifiers according to the historical file identifiers obtained last time, then based on the shell script, save the target files of the target file identifiers. Upload the target files to the cloud server.

[0083] In a possible implementation manner, the target application is Baidu Netdisk.

[0084] In a possible implementation manner, the obtaining of the file identifiers in the file list of the target application includes: Start the shell script; Based on the shell script, call the bypy middleware, so that the list method of the bypy middleware is used to read the file list of the Baidu Netdisk, and obtain the file identifiers in the file list.

[0085] In a possible implementation manner, the saving of the target files of the target file identifiers includes: Based on the shell script, call the bypy middleware, so that the download method of the bypy middleware is used to download the target files of the target file identifiers to a local specified directory.

[0086] In a possible implementation manner, the cloud server is Alibaba Cloud OSS.

[0087] In a possible implementation manner, the uploading of the target files to the cloud server includes: Upload the target files to the Alibaba Cloud Object Storage Service OSS through an https request.

[0088] In a possible implementation manner, the method further includes: Receive the upload return result sent by the cloud server; If the upload return result is upload failure, then record the upload failure log and send a real-time message of upload failure to the specified recipient; If the upload return result is upload success, then record the upload success log, send a real-time message of upload success to the specified recipient, and delete the saved target files.

[0089] In a possible implementation manner, the method further includes: If a file upload instruction carrying other files sent by the cloud server is received, the target application is controlled to save the other files; An other file identifier of the other file is added to the file list.

[0090] Since the principle of the above electronic device for solving problems is similar to that of the file synchronization method, the implementation of the above electronic device can refer to the embodiments of the method, and the repeated parts will not be described again.

[0091] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience in representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 42 is used for communication between the above electronic device and other devices. The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0092] The above processor may be a general-purpose processor, including a central processing unit, a Network Processor (NP), etc.; it may also be a Digital Signal Processing (DSP), an application specific integrated circuit, a field programmable gate array, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Since the principle of the above electronic device for solving problems is similar to that of the action recognition method, the implementation of the above electronic device can refer to the embodiments of the method, and the repeated parts will not be described again. Embodiment

[0093] Based on the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program executable by a processor is stored. When the program runs on the processor, the processor is caused to execute the following steps: If the current meets a preset file scanning condition, based on a shell script, a file identifier in the file list of the target application is obtained; wherein, the file scanning condition includes that the current time is a preset scanning time, or a file scanning instruction is received; If, according to the historical file identifier obtained last time, it is determined that there is a newly added target file identifier in the file identifiers, then based on the shell script, save the target file of the target file identifier; Upload the target file to the cloud server.

[0094] In a possible implementation manner, the target application is Baidu Netdisk.

[0095] In a possible implementation manner, the obtaining of the file identifiers in the file list of the target application includes: Start the shell script; Based on the shell script, call the bypy middleware, so that the list method of the bypy middleware reads the file list of the Baidu Netdisk, and obtain the file identifiers in the file list.

[0096] In a possible implementation manner, the saving of the target file of the target file identifier includes: Based on the shell script, call the bypy middleware, so that the target file of the target file identifier is downloaded to a local specified directory through the download method of the bypy middleware.

[0097] In a possible implementation manner, the cloud server is Alibaba Cloud OSS.

[0098] In a possible implementation manner, the uploading of the target file to the cloud server includes: Upload the target file to the Alibaba Cloud Object Storage Service OSS through an https request.

[0099] In a possible implementation manner, the method further includes: Receive the upload return result sent by the cloud server; If the upload return result is upload failure, record the upload failure log and send a real-time message of upload failure to the specified recipient; If the upload return result is upload success, record the upload success log, send a real-time message of upload success to the specified recipient, and delete the saved target file.

[0100] In a possible implementation manner, the method further includes: If a file upload instruction carrying other files sent by the cloud server is received, control the target application to save the other files; Add the other file identifier of the other file to the file list.

[0101] Since the principle of the above computer-readable storage medium for solving problems is similar to that of the file synchronization method, the implementation of the above computer-readable storage medium can refer to the embodiments of the method, and the repeated parts will not be elaborated here.

[0102] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0103] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0104] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Therefore, the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0106] Obviously, those skilled in the art can make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these modifications and variations.

Claims

1. A file synchronization method, characterized in that, The method includes: If the current preset file scanning condition is met, based on the shell script, obtain the file identifiers in the file list of the target application; wherein, the file scanning condition includes that the current time is the preset scanning time, or a file scanning instruction is received; If it is determined based on the historical file identifiers obtained last time that there are new target file identifiers among the file identifiers, save the target files corresponding to the target file identifiers based on the shell script; Upload the target files to the cloud server.

2. The method according to claim 1, wherein, The target application is Baidu Netdisk.

3. The method according to claim 2, wherein The obtaining of the file identifiers in the file list of the target application includes: Start the shell script; Based on the shell script, call the bypy middleware, so as to read the file list of the Baidu Netdisk through the list method of the bypy middleware and obtain the file identifiers in the file list.

4. The method according to claim 2 or 3, characterized in that, The saving of the target files corresponding to the target file identifiers includes: Based on the shell script, call the bypy middleware, so as to download the target files corresponding to the target file identifiers to the local specified directory through the download method of the bypy middleware.

5. The method according to claim 1, characterized in that, The cloud server is Alibaba Cloud OSS.

6. The method according to claim 5, characterized in that, The uploading of the target files to the cloud server includes: Upload the target files to the Alibaba Cloud Object Storage Service OSS through an https request.

7. The method according to claim 1 or 6, characterized in that, The method further includes: Receive the upload return result sent by the cloud server; If the upload return result is upload failure, record the upload failure log and send a real-time message of upload failure to the specified recipient; If the upload return result is upload success, record the upload success log, send a real-time message of upload success to the specified recipient, and delete the saved target files.

8. The method according to claim 1, characterized in that, The method further includes: If a file upload instruction carrying other files is received from the cloud server, control the target application to save the other files; Add the other file identifiers of the other files to the file list.

9. A file synchronization device, characterized in that, The device includes: A processing module, configured to, if the current preset file scanning condition is met, based on the shell script, obtain the file identifiers in the file list of the target application; wherein, the file scanning condition includes that the current time is the preset scanning time, or a file scanning instruction is received; if it is determined based on the historical file identifiers obtained last time that there are new target file identifiers among the file identifiers, save the target files corresponding to the target file identifiers based on the shell script; A synchronization module, configured to upload the target files to the cloud server.

10. An electronic device, characterized in that, The electronic device includes a processor, and the processor is configured to implement the steps of the file synchronization method according to any one of claims 1-8 when executing the computer program stored in the memory.