[轉]Linux命令行上傳文件到 百度網盤 bypy


安裝軟件工具:

apt-get install python-pip
pip install requests
pip install bypy

 


授權登陸:

執行 bypy info,顯示下邊信息,根據提示,通過瀏覽器訪問下邊灰色的https鏈接,如果此時百度網盤賬號正在登陸,會出現長串授權碼,復制。

[root@ineedle ~]# bypy info
Please visit: # 訪問下邊這個連接,復制授權碼
https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=q8WE4EpCsau1oS0MplgMKNBn
And authorize this app
Paste the Authorization Code here within 10 minutes.
Press [Enter] when you are done # 提示在下邊粘貼授權碼

 

在下邊圖示紅色位置粘貼授權碼,耐心等待一會即可(1-2分鍾)

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 downfile 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 -v upload localfile cloudfile

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

 

如果bypy找不到命令:

  可以直接執行命令文件:/usr/local/python3/bin/bypy

 

 


————————————————
版權聲明:本文為CSDN博主「艾小米」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/mier9042/article/details/82918565


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM