• The important parts:
  • mega-login your@email.com
    # You’ll be prompted for the password (or use a session file)
    

    If you only want to download a public folder, you can skip login – the public link already carries the decryption key.


    When a user clicks the link:

    https://mega.nz/folder/ABcDeFGH?key=KlmNoPqrSTUvwxYz
    

    or the compact form

    https://mega.nz/folder/ABcDeFGH#KlmNoPqrSTUvwxYz
    

    Copy this URL – it contains both the folder ID and the decryption key, so anyone with the link can read the contents.


    | Symptom | Likely Cause | Fix | |---------|--------------|-----| | mega-get: Invalid link | Missing #key part or extra whitespace. | Ensure the URL is exactly as shown in MEGA’s “Get link” dialog; wrap it in quotes. | | mega-login: Authentication failed | Wrong password / two‑factor code. | Use mega-login -a for app‑passwords, or generate a session file (mega-session) and reuse it. | | xclip: not found | Clipboard utility missing. | Install (sudo apt install xclip on Debian/Ubuntu) or use wl-copy/pbcopy. | | Download stalls at 0 B/s | ISP blocks MEGA’s ports (TCP 443 is fine, but sometimes 80/8080). | Force the use of the default port: mega-get --no-proxy … or configure a VPN. | | “File already exists” on mega-import | The folder already exists in your remote path. | Add -f (force) to overwrite, or choose a different destination. | | mega-cp: Permission denied | Trying to copy from a public folder without importing first. | Use mega-import first, then mega-cp. |


    Below is a ready‑to‑run Bash script that:

    #!/usr/bin/env bash
    set -euo pipefail
    # -------------------------------------------------
    # CONFIGURATION
    # -------------------------------------------------
    MEGA_LINK="$1:-"
    DEST_LOCAL="./mega_download"
    DEST_REMOTE="/Imported"
    # -------------------------------------------------
    # HELP
    # -------------------------------------------------
    if [[ -z "$MEGA_LINK" ]]; then
      cat <<EOF
    Usage: $0 <MEGA_FOLDER_LINK>
    Example:
      $0 "https://mega.nz/folder/ABcDeFGH#KlmNoPqrSTUvwxYz"
    The script will:
      • copy the link to the clipboard,
      • download the folder to $DEST_LOCAL,
      • import the folder into your own MEGA account at $DEST_REMOTE.
    EOF
      exit 1
    fi
    # -------------------------------------------------
    # 1. Copy link to clipboard (Linux/macOS)
    # -------------------------------------------------
    if command -v xclip >/dev/null; then
      echo "$MEGA_LINK" | xclip -selection clipboard
      echo "✅ Link copied to X clipboard."
    elif command -v wl-copy >/dev/null; then
      echo "$MEGA_LINK" | wl-copy
      echo "✅ Link copied to Wayland clipboard."
    elif command -v pbcopy >/dev/null; then
      echo "$MEGA_LINK" | pbcopy
      echo "✅ Link copied to macOS clipboard."
    else
      echo "⚠️ Clipboard utility not found – skipping copy step."
    fi
    # -------------------------------------------------
    # 2. Download the public folder locally
    # -------------------------------------------------
    mkdir -p "$DEST_LOCAL"
    echo "🔽 Downloading folder to $DEST_LOCAL ..."
    mega-get "$MEGA_LINK" "$DEST_LOCAL"
    # -------------------------------------------------
    # 3. Import the folder into your MEGA account
    # -------------------------------------------------
    echo "📥 Importing folder into your MEGA account at $DEST_REMOTE ..."
    mega-import "$MEGA_LINK" "$DEST_REMOTE"
    echo "✅ All done! 🎉"
    echo "  • Local copy: $DEST_LOCAL"
    echo "  • Remote copy: $DEST_REMOTE"
    

    Run it (after chmod +x script.sh):

    ./script.sh "https://mega.nz/folder/ABcDeFGH#KlmNoPqrSTUvwxYz"
    

    The script works on Linux/macOS. On Windows, replace the clipboard section with PowerShell’s Set-Clipboard and run the rest in a PowerShell Core session (pwsh).


    Unlike many cloud services, anyone with the full https meganz folder cp link can download the contents without creating a MEGA account. This lowers friction for sharing large datasets, software archives, media collections, or backup files.

    The “cp” in your search likely refers to this copy/import action.