Megacmd: A command-line client for mega.nz storage service

megacmd

megacmd is a utility for copying files to and from your Mega storage service.

How to obtain megacmd ?

Compile from source –

Mac OSX

Linux

Windows

 

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.

  1. Ensure you’re in your home directory
     cd
    
  2. 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
    
  3. 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
    
  4. Unpack the Go compiler
     tar xvf go1.3.3.linux-amd64.tar.gz
    
  5. Copy the Go binaries to the ~/bin directory
     cp ~/go/bin/* ~/bin/
    
  6. Clone the megacmd Git repository
     git clone https://github.com/t3rm1n4l/megacmd.git
    
  7. Change to the megacmd directory
     cd megacmd
    
  8. Compile megacmd
     GOROOT="${HOME}/go" make
    
  9. Copy the compiled megacmd to the ~/bin directory, allowing it to be used in any directory
     cp 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
}

 

 

author of this: whatbox.ca

One thought on “Megacmd: A command-line client for mega.nz storage service

  1. pi@raspberrypi:~ $ cd megacmd
    pi@raspberrypi:~/megacmd $ GOROOT=”${HOME}/go” make
    go build -o megacmd
    /home/pi/bin/go: 1: /home/pi/bin/go: Syntax error: Unterminated quoted string
    make: *** [Makefile:8: build] Error 2

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s