Linux命令行上傳文件到百度網(wǎng)盤

百度云/百度網(wǎng)盤Python客戶端github項目
系統(tǒng)環(huán)境:
linux與ma + python3.6
安裝依賴包

pip install requests
pip install bypy==1.6.10

授權(quán)登陸:

執(zhí)行 bypy info,顯示下邊信息,根據(jù)提示镶摘,通過瀏覽器訪問下邊灰色的https鏈接,如果此時百度網(wǎng)盤賬號正在登陸渴析,會出現(xiàn)長串授權(quán)碼梭稚,復(fù)制。

bypy info

顯示如下信息

Please visit: # 訪問下邊這個連接怨规,復(fù)制授權(quán)碼
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 # 提示在下邊粘貼授權(quán)碼

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

Authorizing, please be patient, it may take upto 300 seconds...
Authorizing with the Heroku server ...
Heroku server failed, authorizing with the Heroku1 server ...
Successfully authorized
Quota: 6.112TB
Used: 1.569TB

授權(quán)成功。
顯示在云盤(程序的)根目錄下文件列表:

bypy list

把當(dāng)前目錄同步到云盤:

bypy syncup

or

bypy upload

把云盤內(nèi)容同步到本地來:

bypy syncdown

or

bypy downdir /

比較本地當(dāng)前目錄和云盤(程序的)根目錄(個人認為非常有用):

bypy compare

更多增刪改查等操作可以執(zhí)行以下命令

bypy help

Commands:
refreshtoken - refresh the access token
cdl_add <source_url> [save_path] [timeout] - add an offline (cloud) download task
cdl_addmon <source_url> [save_path] [timeout] - add an offline (cloud) download task and monitor the download progress
cdl_cancel <task_id> - cancel an offline (cloud) download task
cdl_list - list offline (cloud) download tasks
cdl_query <task_ids> - query existing offline (cloud) download tasks
cleancache - remove invalid entries from hash cache file
combine <remotefile> [localfile] [md5s] - try to create a file at PCS by combining slices, having MD5s specified
compare [remotedir] [localdir] - compare the remote directory with the local directory
copy/cp <from> <to> - copy a file / dir remotely at Baidu Yun
delete/remove/rm <remotepath> - delete a file / dir remotely at Baidu Yun
downdir [remotedir] [localdir] - download a remote directory (recursively)
downfile <remotefile> [localpath] - download a remote file.
download [remotepath] [localpath] - download a remote directory (recursively) / file
dumpcache - display file hash cache
list/ls [remotepath] [format] [sort] [order] - list the 'remotepath' directory at Baidu PCS
listrecycle [start] [limit] - list the recycle contents
meta <remotepath> [format] - get information of the given path (dir / file) at Baidu Yun.
mkdir <remotedir> - create a directory at Baidu Yun
move/mv/rename/ren <from> <to> - move a file / dir remotely at Baidu Yun
quota/info - displays the quota information
restore <remotepath> - restore a file from the recycle bin
search <keyword> [remotepath] [recursive] - search for a file using keyword at Baidu Yun
stream <remotefile> <localpipe> [format] [chunk] - stream a video / audio file converted to M3U format at cloud side, to a pipe.
syncdown [remotedir] [localdir] [deletelocal] - sync down from the remote directory to the local directory
syncup [localdir] [remotedir] [deleteremote] - sync up from the local directory to the remote directory
upload [localpath] [remotepath] [ondup] - upload a file or directory (recursively)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末波丰,一起剝皮案震驚了整個濱河市壳坪,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌掰烟,老刑警劉巖爽蝴,帶你破解...
    沈念sama閱讀 222,946評論 6 518
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異纫骑,居然都是意外死亡蝎亚,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,336評論 3 399
  • 文/潘曉璐 我一進店門先馆,熙熙樓的掌柜王于貴愁眉苦臉地迎上來发框,“玉大人,你說我怎么就攤上這事煤墙∶饭撸” “怎么了宪拥?”我有些...
    開封第一講書人閱讀 169,716評論 0 364
  • 文/不壞的土叔 我叫張陵,是天一觀的道長铣减。 經(jīng)常有香客問我她君,道長,這世上最難降的妖魔是什么徙歼? 我笑而不...
    開封第一講書人閱讀 60,222評論 1 300
  • 正文 為了忘掉前任犁河,我火速辦了婚禮,結(jié)果婚禮上魄梯,老公的妹妹穿的比我還像新娘桨螺。我一直安慰自己,他們只是感情好酿秸,可當(dāng)我...
    茶點故事閱讀 69,223評論 6 398
  • 文/花漫 我一把揭開白布灭翔。 她就那樣靜靜地躺著,像睡著了一般辣苏。 火紅的嫁衣襯著肌膚如雪肝箱。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,807評論 1 314
  • 那天稀蟋,我揣著相機與錄音煌张,去河邊找鬼。 笑死退客,一個胖子當(dāng)著我的面吹牛骏融,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播萌狂,決...
    沈念sama閱讀 41,235評論 3 424
  • 文/蒼蘭香墨 我猛地睜開眼档玻,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了茫藏?” 一聲冷哼從身側(cè)響起误趴,我...
    開封第一講書人閱讀 40,189評論 0 277
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎务傲,沒想到半個月后凉当,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 46,712評論 1 320
  • 正文 獨居荒郊野嶺守林人離奇死亡售葡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,775評論 3 343
  • 正文 我和宋清朗相戀三年看杭,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片天通。...
    茶點故事閱讀 40,926評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡泊窘,死狀恐怖熄驼,靈堂內(nèi)的尸體忽然破棺而出像寒,到底是詐尸還是另有隱情烘豹,我是刑警寧澤,帶...
    沈念sama閱讀 36,580評論 5 351
  • 正文 年R本政府宣布诺祸,位于F島的核電站携悯,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏筷笨。R本人自食惡果不足惜憔鬼,卻給世界環(huán)境...
    茶點故事閱讀 42,259評論 3 336
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望胃夏。 院中可真熱鬧轴或,春花似錦、人聲如沸仰禀。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,750評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽答恶。三九已至饺蚊,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間悬嗓,已是汗流浹背污呼。 一陣腳步聲響...
    開封第一講書人閱讀 33,867評論 1 274
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留包竹,地道東北人燕酷。 一個月前我還...
    沈念sama閱讀 49,368評論 3 379
  • 正文 我出身青樓,卻偏偏與公主長得像映企,于是被迫代替她去往敵國和親悟狱。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,930評論 2 361

推薦閱讀更多精彩內(nèi)容