Wiki > megacmd_old
megacmd is a utility for copying files to and from your Mega storage service.
Usage
Usage ./megacmd:
megacmd [OPTIONS] list mega:/foo/bar/
megacmd [OPTIONS] get mega:/foo/file.txt /tmp/
megacmd [OPTIONS] put /tmp/hello.txt mega:/bar/
megacmd [OPTIONS] delete mega:/foo/bar
megacmd [OPTIONS] mkdir mega:/foo/bar
megacmd [OPTIONS] move mega:/foo/file.txt mega:/bar/foo.txt
megacmd [OPTIONS] sync mega:/foo/ /tmp/foo/
megacmd [OPTIONS] sync /tmp/foo mega:/foo
-conf="/Users/slakshman/.megacmd.json": Config file path
-force=false: Force hard delete or overwrite
-help=false: Help
-ignore-same-size=false: Consider files with same size and path suffix as same
-recursive=false: Recursive listing
-verbose=1: Verbose
-version=false: Version
Installation
megacmd is written against go 1.3 and exhibits bugs when compiled with newer versions. Additionally due to the amount of time since the last stable release and with no stable release obvious in the future is it preferable to compile the latest version from git to try and avoid known and fixed issues.
-
Ensure you're in your home directory
cd
-
Create ~/bin and add it to your shell's PATH if you haven't done so before.
mkdir -p ~/bin && echo "PATH=\$HOME/bin:\$PATH" >> ~/.bashrc && source ~/.bashrc
-
Install the required Go 1.3 compiler. We will fetch an official pre-compiled binary ready for use.
wget https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
-
Unpack the Go compiler
tar xvf go1.3.3.linux-amd64.tar.gz
-
Copy the Go binaries to the
~/bin
directorycp ~/go/bin/* ~/bin/
-
Clone the megacmd Git repository
git clone https://github.com/t3rm1n4l/megacmd.git
-
Change to the megacmd directory
cd megacmd
-
Compile megacmd
GOROOT="${HOME}/go" make
-
Copy the compiled megacmd to the
~/bin
directory, allowing it to be used in any directorycp megacmd ~/bin/
Configuration
You can edit ~/.megacmd.json
using your favourite editor like nano (eg: nano ~/.megacmd.json
), and fill out your user credentials. It is not currently possible to store these encrypted so plain text is the only option when using this tool.
{
"User" : "your-mega-username",
"Password" : "your-mega-password",
"DownloadWorkers" : 4,
"UploadWorkers" : 4,
"SkipSameSize" : true,
"Verbose" : 1
}