Pages

Saturday, 2 July 2016

megacmd - 一个mega.co.nz的命令行工具

  • mega.co.nz是一个提供50G免费存储空间的国外网盘,前身为megaupload.
  • megacmd是一个可以用命令行操作mega网盘的工具,可以进行上传,下载,建立文件夹,删除等操作,基本网页上能做的它都能做到.
  • megacmd项目主页:https://github.com/t3rm1n4l/megacmd
  • 本文章只介绍megacmd在Linux下的安装及使用。。。。Windows和mac os请自行参考项目主页.

下载并安装

yum install -y go git
git clone https://github.com/t3rm1n4l/megacmd.git
cd megacmd
GOPATH=/tmp/ make
cp megacmd /usr/local/bin

建立配置文件

 vim ~/.megacmd.json
1
2
3
4
5
6
7
8
{
"User" : "MEGA_USERNAME",
"Password" : "MEGA_PASSWORD",
"DownloadWorkers" : 4,
"UploadWorkers" : 4,
"SkipSameSize" : true,
"Verbose" : 1
}

使用方式

1.列出文件
megacmd list mega:/Test/
mega:/Test/11.png                                  24110      2013-12-31T16:47:49+05:30
mega:/Test/Firefox_wallpaper.png                   81920      2013-12-31T16:49:27+05:30
2.下载文件
megacmd get mega:/Test/11.png ./
Successfully downloaded file mega:/Test/11.png to ./ in 0
3.上传文件
megacmd put ./practice/helloworld mega:/Test/
Copying ./practice/helloworld -> mega:/Test/ # 100.00 % of 8.6KB at 2.5K/s 3s
Successfully uploaded file ./practice/helloworld to mega:/Test/ in 3s
4.删除文件
megacmd delete mega:/Test/helloworld
Successfully deleted  mega:/Test/helloworld
5.建立新文件夹
megacmd  mkdir mega:/Test/subdir
Successfully created directory at mega:/Test/subdir
更多使用方法请看项目主页.