• 欢迎访问db1024网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏db1024吧

Onedrivecmd:OneDrive的命令行客户端,可直接上传/下载文件等

主机教程 Liam 1年前 (2019-04-29) 377次浏览 9个评论 扫描二维码
文章目录[隐藏]

说明:onedrivecmd是一个OneDrive的命令行客户端,可以直接在VPS上对OneDrive网盘进行上传/下载/编辑等操作,还可以直接将文件离线到网盘,支持OneDrive个人版和商业版等,该工具和博主以前发个2Google Drive命令行工具差不多,查看:skickaGdrive,对Google Drive更有兴趣的可以试试。

功能

  • 根据路径取文件。
  • 配置文件 (~/.onedrive.json)。
  • 可对单个文件上传下载。
  • 可列远程目录,包括文件大小和时间戳。
  • 上传与下载有进度条,也可用aria2进行下载。
  • 离线下载(此功能仅通过API提供,Web和官方客户端都是没有的)。
  • 直接获取直链!。
  • Python 23通用。

安装

Github地址:https://github.com/cnbeining/onedrivecmd

说明:博主使用Python 23测试了下,发现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 3pip3

#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客户端确认。
Onedrivecmd:OneDrive的命令行客户端,可直接上传/下载文件等
注意默认配置文件是/root/.onedrive.json,可以自己设置。此文件和你的密码一样重要!泄露会导致你的盘被随便查看!

最后配置成功后,就可以使用上面的命令进行操作了。


db1024 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Onedrivecmd:OneDrive的命令行客户端,可直接上传/下载文件等
喜欢 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(9)个小伙伴在吐槽
  1. Somebody necessarily help to make seriously articles I would state. That is the first time I frequented your website page and so far? I surprised with the research you made to create this actual publish extraordinary. Fantastic activity!
    black mass2020-08-31 10:20 回复 Mac OS X | Chrome 67.0.3396.79
  2. Hi there! I know this is somewhat off topic but I was wondering which blog platform are you using for this site? I'm getting sick and tired of Wordpress because I've had problems with hackers and I'm looking at options for another platform. I would be great if you could point me in the direction of a good platform.
    black mass2020-08-28 19:15 回复 Linux | Chrome 59.0.3071.86
  3. Hi, I think your blog might be having browser compatibility issues. When I look at your website in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, very good blog!
    cheap flights2020-08-27 11:04 回复 Linux | Firefox浏览器 52.9
  4. Peculiar article, just what I needed. cheap flights y2yxvvfw
    cheap flights2020-08-25 18:08 回复 Mac OS X | Chrome 65.0.3325.181
  5. I blog often and I truly appreciate your content. This article has truly peaked my interest. I will take a note of your blog and keep checking for new information about once per week. I subscribed to your Feed too. 2CSYEon cheap flights
    cheap flights2020-08-25 14:28 回复 Linux | Firefox浏览器 54.0
  6. Greetings! This is my 1st comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading your posts. Can you recommend any other blogs/websites/forums that go over the same subjects? Thanks for your time! 3aN8IMa cheap flights
    cheap flights2020-08-24 20:57 回复 Linux | Firefox浏览器 60.0.2
  7. This is a topic that's near to my heart... Cheers! Where are your contact details though?
    web hosting company2020-08-14 07:37 回复 Linux | Firefox浏览器 54.0
  8. You could certainly see your expertise within the article you write. The arena hopes for even more passionate writers such as you who aren't afraid to say how they believe. At all times follow your heart.
    web hosting reviews2020-08-12 05:08 回复 Linux | Firefox浏览器 2.0.0.2
  9. Thanks for sharing your thoughts. I really appreciate your efforts and I will be waiting for your further post thank you once again. adreamoftrains content hosting
    adreamoftrains web hosting companies2020-08-10 17:15 回复 Linux | Firefox浏览器 52.9