bypy实现服务器与百度网盘文件互传
·
Title: bypy实现服务器与百度网盘文件互传
Author: Songbing He
Date: 2025-08-08
Reference: https://github.com/houtianze/bypy
1. 安装软件
pip install bypy
WARNING: The script bypy is installed in ‘/data2/home/xxx/.local/bin’ which is not on PATH.
# 添加环境变量(无warning可跳过)
echo 'export PATH=~/.local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc # 永久生效
echo $PATH # 检查是否添加成功
# 检查是否安装成功
bypy -V # v1.8.9
2. 百度网盘授权
bypy info

复制链接至浏览器获取授权码

3. 基本命令
bypy是百度网盘的Python客户端,支持文件列表、下载、上传、比较、向上同步、向下同步等操作。由于百度PCS API权限限制,仅能操作百度网盘我的应用数据/bypy目录。
# list the 'remotepath' directory at Baidu PCS 查看文件列表
bypy ls [remotepath]
# create a directory at Baidu Yun 新建文件夹
bypy mkdir <remotedir>
# delete a file / dir remotely at Baidu Yun 删除文件
bypy rm <remotepath>
# download a remote directory (recursively) 下载文件
bypy download [remotepath] [localpath]
# upload a file or directory (recursively) 上传文件
bypy upload [localpath] [remotepath]
# remotepath: remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun
# localpath: local path at Linux. if not specified, it is set to the current directory
# 解绑
# Linux服务器端解绑
bypy -c
# 百度网盘端解绑
https://passport.baidu.com/accountbind?tpl=
更多推荐
所有评论(0)