01
2020
10

Baidu Cloud

安装软件工具:


apt-get install python-pip

pip install requests

pip install bypy

or pip install bypy==1.6.10


授权登陆:


执行 bypy info,显示下边信息,根据提示,通过浏览器访问下边灰色的https链接,如果此时百度网盘账号正在登陆,会出现长串授权码,复制。

visit:

https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=q8WE4EpCsau1oS0MplgMKNBn


Paste the Authorization Code here within 10 minutes.

Press [Enter] when you are done

a288f3d775fa905a6911692a0808f6a8


Authorizing, please be patient, it may take upto None seconds...
Authorizing/refreshing with the OpenShift server ...
OpenShift server failed, authorizing/refreshing with the Heroku server ...
Successfully authorized
Quota: 2.015TB
Used: 740.493GB



授权成功。


bypy list             查看目录


bypy mkdir         新建目录


bypy upload       把本地当前目录下的文件同步到百度云盘


bypy downdir     把云盘上的内容同步到本地


bypy list #显示文档

bypy upload filename         上传文档

bypy downdir filename       下载文件(存在问题)

bypy compare                     比较本地当前目录和云盘(程序的)根目录

bypy -c                                取消令牌文件。一段时间后要重新授权






命令:bypy upload localfile cloudfile


说明:1) localfile为本地文件路径


    2)cloudfile为云端文件路径


   3)由于百度的限制,最终文件只能上传到云盘,我的应用程序(apps) /bypy下


举例: bypy upload C:\Mytemp\1.txt  /cloud



将本地C:\Mytemp\1.txt文件上传到云盘我的应用程序(apps) /bypy/cloud 文件夹内 (注意云端文件夹 用"/" ,本地文件夹用"\"


也可上传整个文件夹,命令示例如下:


bypy upload C:\Mytemp /cloud    (将本地C:\Mytemp文件夹内所有文件上传到云盘 apps/bypy/cloud 文件夹内)     


***预设网盘目录我的应用程序/bypy or apps/bypy/ = /



如果要显示上传进度,可使用命令:bypy -v upload localfile cloudfile


举例:bypy -v upload C:\Mytemp  /cloud



把xxxx.zip上傳到百度網盤-我的應用程序(apps)/bypy 下


bypy -v --chunk 512 -s 10MB --on-dup overwrite upload /root/Bk \Bk                local route of file           cloud server side directory (apps)/bypy/Bk       split to 10Mb file with chunk of 512kb upload speed


bypy -v upload /var/www/html/testweb/blog.zip \blog.zip


root@localhost: /var/www# bypy -v \xxxx.zip /xxxx.zip



How to zip a folder?


zip -r /var/www/html/testweb/blog.zip /var/www/html/testweb/blog


How to remove the file?

rm -f /var/www/html/testweb/blog.zig



MySQL default route:

/var/lib/mysql


zip -r /var/www/html/testweb/mysql.zip /var/lib/mysql


bypy -v upload /var/www/html/testweb/mysql.zip \mysql.zip




« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。