Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Rules have been updated! Here

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[-]
Tags
commandline megacmd tool mega nz for

Megacmd Commandline tool for Mega.nz
#1
Windows

Once you have MEGAcmd installed, you can start the interactive shell from the Start Menu or desktop icon. On windows the interactive shell executable is called MEGAcmdShell.exe and the server is MEGAcmdServer.exe.

On Windows 7, we recommend using the MEGAcmd shell from inside PowerShell for a better user experience (and you can do this on other Windows platforms also). You can start powershell from the Start Menu and then execute these commands to start it:

MEGAcmdShell
For scriptable usage, the MEGAcmd commands are provided via installed .bat files which pass the command to the MEGAcmdServer.exe. Provided you have set the PATH as above, you can use these like normal command line tools in PowerShell:

Command Prompt:
set PATH=%LOCALAPPDATA%\MEGAcmd;%PATH%
mega-cd /my/favourite/folder
mega-ls

Commands referring to a remote path are talking about a file in your MEGA account online, whereas a local path refers to a file or folder on your local device where MEGAcmd is running.

Verbosity: You can increase the amount of information given by any command by passing -v (-vv, -vvv, ...)
Account / Contacts
    signupemail [password] [--name="Your Name"] Register as user with a given email.
    confirmlink email [password] Confirm an account using the link provided after the "signup" process.
    invite[-d|-r] dstemail [--message="MESSAGE"] Invites a contact / deletes an invitation.
    showpcr[--in | --out] Shows incoming and outgoing contact requests.
    ipcemail|handle -a|-d|-i Manages contact incoming invitations.
    users[-s] [-h] [-n] [-d contact@email] List contacts
    userattr[-s attribute value|attribute] [--user=user@email] Lists/updates user attributes
    passwd[oldpassword newpassword] Modifies user password
    masterkeypathtosave Shows your master key.

Login / Logout
    login[email [password]] | exportedfolderurl#key | session Logs into MEGA
    logout[--keep-session] Logs out
    whoami[-l] Print info of the user
    session Prints (secret) session ID
    killsession[-a|sessionid] Kills a session of current user.

Browse
    cd[remotepath] Changes the current remote folder
    lcd[localpath] Changes the current local folder for the interactive console
    ls[-lRr] [remotepath] Lists files in a remote path
    pwd Prints the current remote folder
    lpwd Prints the current local folder for the interactive console
    attrremotepath [-s attribute value|-d attribute] Lists/updates node attributes
    du[-h] [remotepath remotepath2 remotepath3 ... ] Prints size used by files/folders
    find[remotepath] [-l] [--pattern=PATTERN] [--mtime=TIMECONSTRAIN] [--size=SIZECONSTRAIN] Find nodes matching a pattern
    mount Lists all the main nodes

Moving/Copying Files
    mkdir[-p] remotepath Creates a directory or a directory hierarchy
    cpsrcremotepath dstremotepath|dstemail Copies a file/folder into a new location (all remotes)
    put[-c] [-q] [--ignore-quota-warn] localfile [localfile2 localfile3 ...] [dstremotepath] Uploads files/folders to a remote folder
    get[-m] [-q] [--ignore-quota-warn] exportedlink#key|remotepath [localpath] Downloads a remote file/folder or a public link
    preview[-s] remotepath localpath To download/upload the preview of a file.
    thumbnail[-s] remotepath localpath To download/upload the thumbnail of a file.
    mvsrcremotepath [srcremotepath2 srcremotepath3 ..] dstremotepath Moves file(s)/folder(s) into a new location (all remotes)
    rm[-r] [-f] remotepath Deletes a remote file/folder
    transfers[-c TAG|-a] | [-r TAG|-a] | [-p TAG|-a] [--only-downloads | --only-uploads] [SHOWOPTIONS] List or operate with transfers
    speedlimit[-u|-d] [-h] [NEWLIMIT] Displays/modifies upload/download rate limits
    sync[localpath dstremotepath| [-dsr] [ID|localpath] Controls synchronizations
    exclude[(-a|-d) pattern1 pattern2 pattern3 [--restart-syncs]] Manages exclusions in syncs.
    backuplocalpath remotepath --period="PERIODSTRING" --num-backups=N Set up a new backup folder and/or schedule
    backup[-lhda] [TAG|localpath] [--period="PERIODSTRING"] [--num-backups=N]) View/Modify an existing backup schedule

Sharing (your own files, of course, without infringing any copyright)
    cpsrcremotepath dstremotepath|dstemail Moves a file/folder into a new location (all remotes)
    export[-d|-a [--expire=TIMEDELAY]] [remotepath] Prints/Modifies the status of current exports
    importexportedfilelink#key [remotepath] Imports the contents of a remote link into your account
    share[-p] [-d|-a [email protected] [--level=LEVEL]] [remotepath] Prints/Modifies the status of current shares
    webdav[ [-d] remotepath [--port=PORT] [--public] [--tls --certificate=/path/to/certificate.pem --key=/path/to/certificate.key]] Sets up the ability to download a file from your MEGA account via your PC/device.

Misc
    version[-l][-c] Prints MEGAcmd versioning and extra info
    deleteversions [-f] (--all | remotepath1 remotepath2 ...) Delete prior versions of files to save space.
    unicode Toggle unicode input enabled/disabled in interactive shell
    reload Forces a reload of the remote files of the user
    help[-f] Prints list of commands
    https[on|off] Shows if HTTPS is used for transfers. Use https on to enable it.
    clear Clear screen
    log[-sc] level Prints/Modifies the current logs level
    debug Enters debugging mode (HIGHLY VERBOSE)
    exit|quit [--only-shell] Quits MEGAcmd

cd
Changes the current remote folder (example)

Usage: cd [remotepath]
If no folder is provided, it will be changed to the root folder

clear
Clear screen

Usage: clear
confirm

Confirm an account using the link provided after the "signup" process. (example)

Usage: confirm link email [password] It requires the email and the password used to obtain the link.
cp
Moves a file/folder into a new location (all remotes)
Usage: cp srcremotepath dstremotepath|dstemail:

If the location exists and is a folder, the source will be copied there.
If the location doesn't exist, the file/folder will be renamed to the destination name given.

If "dstemail:" provided, the file/folder will be sent to that user's inbox (//in)
e.g: cp /path/to/file [email protected]:
Remember the trailing ":", otherwise a file with the name of that user ("[email protected]") will be created

Changes will not be applied immediately to actions being performed in active syncs.
After adding/deleting patterns, you might want to:
a) disable/reenable synchronizations manually
b) restart MEGAcmd server
c) use --restart-syncs flag. Caveats:
  This will cause active transfers to be restarted
  In certain cases --restart-syncs might be unable to re-enable a synchronization.
  In such case, you will need to manually resume it or restart MEGAcmd server.

By default this command will exit both the interactive shell and the command server.
To only exit current shell and keep server running, use `exit --only-shell`

Exiting the server does not cancel the session, and the encrypted local cache of your account is kept on your PC.
The session will be resumed when the service is restarted.

get
Downloads a remote file/folder or a public link (example)
Usage: get [-m] [-q] [--ignore-quota-warn] exportedlink#key|remotepath [localpath]

If the remotepath is a file, it will be downloaded to folder specified in localpath (or to the current folder if not specified).
If the localpath (destination) already exists and is the same (by content) then nothing will be done. If it differs, it will create a new file appending " (NUM)".
If the remotepath or exportedlink is a folder, the folder and its entire contents will be downloaded into the destination folder.

Options:
  -q                    queue download: execute in the background.
  -m                    if the folder already exists, the contents will be merged with the downloaded one (preserving the existing files)
  --ignore-quota-warn  ignore quota surpassing warning. The download will be attempted anyway.

login
Log into your MEGA account (example)
Usage: login [email [password]] | exportedfolderurl#key | session

You can log in either with email and password, with session ID, or into a folder (an exported/public folder).
If logging into a folder indicate url#key

logout
Closes your session for security or to allow subsequently logging into a different account. (example)
Usage: logout [--keep-session]

Options:
  --keep-session    The current session is not closed, allowing logging back into it later using the session ID rather than email/password.

whoami
Print account information (example)
Usage: whoami [-l]

Options:
-l    Show extended info: total storage used, storage per main folder
        (see mount), pro level, account balance, and also the active sessions

Download Official :
Code:
The contents of this section are hidden
You have No permissions

Portable by Disk2019 :
Code:
The contents of this section are hidden
You have No permissions
[-] The following 1 user says Thank You to MaskedUser for this post:
  • TanMan
Reply


Messages In This Thread
Megacmd Commandline tool for Mega.nz - by MaskedUser - 10-12-2019, 12:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)