onedrivecmd是一个OneDrive的号令行客户端,能够径直在VPS上对OneDrive网盘举行上传/下载/编纂等操纵,还能够径直将文献离线到网盘,支援OneDrive小我私家版和贸易版等,该东西和伏笔VPS先前发个2款Google Drive号令行东西差未几,检察:skicka、Gdrive,对Google Drive更有趣味的能够尝尝。
效能
依据途径取文献。
文献 (~/.onedrive.json)。
可对单个文献上传下载。
可列长途目次,包罗文献巨细和时期戳。
上传与下载有进度条,也可用aria2举行下载。
离线下载(此效能仅经过API供给,Web和官方客户端都是没局部)。
径直获得直链!。
Python 2和3通用。
装置
Github地点:https://github.com/cnbeining/onedrivecmd
应用Python 2和3测试了下,发明Python 2下会涌现点小成绩,不外也仍是能够用的,这边提议经过Python 3装置Onedrivecmd。
1、装置pip或pip3
如其你想用Python 2,普通体系都自带Python 2,能够应用以下号令装置pip:
#CentOS 6.x 32位
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum install -y python-pip
#CentOS 6.x 64位
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y python-pip
#CentOS 7.x
yum install -y epel-release
yum install -y python-pip
#如其CentOS 7装置涌现No package python-pip available,能够用以下号令举行装置
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
#Debian/Ubuntu体系
apt-get -y update
apt-get -y install python-pip
如其你想用Python 3,能够应用以下本子主动装置Python 3和pip3:
#Ubuntu许多体系自带Python 3,就不说装置方式了
#CentOS体系
wget https://www.moerats.com/usr/shell/Python3/CentOS_Python3.6.sh && sh CentOS_Python3.6.sh
#Debian体系
wget https://www.moerats.com/usr/shell/Python3/Debian_Python3.6.sh && sh Debian_Python3.6.sh
#检察能否装置胜利
python3 -V
2、装置onedrivecmd
#Python 2装置
pip install onedrivecmd
#Python 3装置
pip3 install onedrivecmd
应用
1、应用号令
#注重根目次为od:/,后头带/为目次,不带为文献
Usage onedrivecmd:
onedrivecmd -h
onedrivecmd [OPTIONS] init 小我私家版登岸
onedrivecmd [OPTIONS] init_business 企业/Office 365/Education登岸
onedrivecmd [OPTIONS] list od:/foo/bar/ 列目次
onedrivecmd [OPTIONS] share od:/foo/bar/ 同享
onedrivecmd [OPTIONS] direct od:/foo/bar/ 取直链!这个直链不外期
onedrivecmd [OPTIONS] get od:/foo/file.txt /tmp/ 下载
onedrivecmd [OPTIONS] put /tmp/hello.txt od:/bar/ 上传
onedrivecmd [OPTIONS] delete od:/foo/bar 剔除
onedrivecmd [OPTIONS] mkdir od:/foo/bar/ 建目次
onedrivecmd [OPTIONS] search foobar 搜刮
onedrivecmd [OPTIONS] remote http://thecatapi.com/api/images/get?format=src&type=gif 离线下载
onedrivecmd [OPTIONS] quota 看容量
[OPTIONS]
-conf="~/.onedrive.json": 配备文献,此文献和暗码一样主要
-h: 协助
-hack: 用SDK上传/aria2下载
-recursive=false: 递归列目次,速率比设想中慢很多
-chunk=62914560: 上传分片巨细,必需是320K的倍数,不克不及超越60MB
-url=False: 只列出文献下载URL,这个URL失灵很快
2、应用示例
率先应用号令登录OneDrive。
#小我私家版登录号令
onedrivecmd init
#企业/Office 365/Education登录号令
onedrivecmd init_business
然后将那串网址复制到阅读器登录账号,再将考证码输到SSH客户端确认。

注重默许配备文件是/root/.onedrive.json,能够本人设置。此文件和你的密码一样主要!走漏风声会招致你的盘被随意查看!
网友评论