Linux command line upload file to Baidu Network disk

Source: Internet
Author: User

Recently in the study of MySQL Bin-log time to take into account the problem of data backup, suddenly thought that if you can be the data through the Linux command Line backup to Baidu network disk, that is how a thing. Baidu Network disk has free 2TB storage space, and has Baidu to do patron, not afraid of data loss, safe and reliable. Say dry, through Baidu and Google found a few ways, compare like bypy way, use simple, convenient. The bottom of a simple summary of how to use the Bypy to achieve the synchronization of Baidu network disk data.

This is a Baidu cloud Python client, its main purpose and function is to provide Linux users with a command line, the use of Baidu cloud disk 2T storage space method. It provides file list, download, upload, compare, sync up, sync down, and more.

System environment:

Linux system + Python 2.7

Install software tools:

Pip Install Requestspip Install Bypy

Authorized Login:

Execute Bypy info, display the following information, according to the hint, through the browser to access the gray HTTPS link below, if at this time Baidu network Disk account is landing, there will be a long list of authorization code, copy.

[[email protected] ~]# bypy infoplease visit:   # Access the bottom of this connection, copy the authorization code https://openapi.baidu.com/ Oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=  Q8WE4EPCSAU1OS0MPLGMKNBNand authorize this apppaste the Authorization Code here within minutes. Press [Enter]    When you're done # hint to paste the authorization code below

Paste the Authorization code in the red position below, and wait patiently for a moment (1-2 minutes)

Press [Enter] When you were donea288f3d775fa905a6911692a0808f6a8authorizing, please be patient, it could take upto None Secon Ds... Authorizing/refreshing with the OpenShift server ... OpenShift server failed, authorizing/refreshing with the Heroku server ... Successfully AUTHORIZEDQUOTA:2.015TBUSED:740.493GB

Authorization is successful.

Test upload and synchronize local files to cloud disk

Because of the Baidu PCs API permission restrictions, the program can only access Baidu Cloud/apps/bypy directory below the files and directories. We can do this by:

[Email protected] ~]# bypy list/apps/bypy ($t $f $s $m $d):

Synchronize the files in the local current directory to the Baidu cloud disk:

# Bypy Upload

Synchronize the contents of the cloud disk to the Local:

# Bypy Downdir

Compare the local current directory and the cloud packing directory to see if it is consistent to determine if the synchronization is successful:

# Bypy Compare

Linux command line upload file to Baidu Network disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.