linux上传文件到百度云盘

您所在的位置:网站首页 怎么把软件上传到百度云盘 linux上传文件到百度云盘

linux上传文件到百度云盘

2024-07-16 08:59| 来源: 网络整理| 查看: 265

最近考虑linux数据备份的问题,最中选用了 bypy方式。下边简单的总结一下如何使用 bypy 实现百度网盘数据的同步。

bypy是一个百度云的 Python 客户端,其主要目的和功能,就是为 Linux 使用者提供一种在命令行下,使用百度云盘存储空间的方法。它提供文件列表、下载、上传、比较、向上同步、向下同步,等操作。

系统环境:

Linux 系统 + Python 2.7

安装软件工具:

pip install requests pip install bypy

授权登陆:

执行

bypy info

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

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 ere 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: 3.000TB Used: 568.052GB

授权成功。

测试上传和同步本地文件到云盘

由于百度PCS API权限限制,程序只能存取百度云端/apps/bypy目录下面的文件和目录。我们可以通过:

ubuntu@VM-3-36-ubuntu:~$ bypy list /apps/bypy ($t $f $s $m $d):

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

# bypy upload

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

# bypy downdir

比较本地当前目录和云盘根目录,看是否一致,来判断是否同步成功:

# bypy compare

转载自:https://www.cnblogs.com/chenliyang/p/6634673.html



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3