### Megatools Configuration File Example Source: https://xff.cz/megatools/man/megarc An example of the megarc configuration file, demonstrating the structure and common settings for [Login], [Network], and [UI] sections. This file allows users to pre-configure megatools for automatic login and network behavior. ```ini [Login] Username = your@email Password = yourpassword [Network] # 1MiB/s SpeedLimit = 1024 # Use over TOR Proxy = socks5://127.0.0.1:9050 ParallelTransfers = 2 [UI] Colors = true ``` -------------------------------- ### Upload a file to the root directory Source: https://xff.cz/megatools/man/megatools-put This example demonstrates how to upload a local file named 'README' to the root directory of your Mega.nz account. It then shows how to verify the upload using the 'megatools ls' command. ```bash $ megatools put README $ megatools ls /Root /Root /Root/README ``` -------------------------------- ### Check Scripted Free Space Threshold Source: https://xff.cz/megatools/man/megatools-df This example shows how to check if the available free space in the cloud is below a certain threshold using a shell script. It utilizes the --free and --gb options of megatools df to get the free space in GiB and then uses a test command to compare it. This is useful for automated monitoring. ```bash $ test `megatools df --free --gb` -lt 1 && \ echo "You have less than 1 GiB of available free space" ``` -------------------------------- ### Display Human-Readable Cloud Space Usage Source: https://xff.cz/megatools/man/megatools-df This example demonstrates how to display the total, used, and free space in a human-readable format using the megatools df command. It requires no special dependencies beyond the megatools utility itself and an authenticated account. ```bash $ megatools df -h Total: 50.0 GiB Used: 6.4 GiB Free: 43.6 GiB ``` -------------------------------- ### Upload a file with a different remote name Source: https://xff.cz/megatools/man/megatools-put This example shows how to upload a local file ('README') and specify a different name for it on the remote Mega.nz account ('/Root/README.TXT'). It also verifies the upload using 'megatools ls'. ```bash $ megatools put --path /Root/README.TXT README $ megatools ls /Root /Root /Root/README.TXT ``` -------------------------------- ### Remove a contact from Mega.nz using megatools-rm Source: https://xff.cz/megatools/man/megatools-rm This example shows how to remove a contact from your Mega.nz contact list. It targets a contact with the email address 'some@email.com' by removing the corresponding directory entry under '/Contacts'. ```bash $ megatools rm /Contacts/some@email.com ``` -------------------------------- ### Remove a folder using megatools-rm Source: https://xff.cz/megatools/man/megatools-rm This example demonstrates how to remove a folder named 'MyNewFolder' located in the '/Root' directory of your Mega.nz account using the megatools-rm command. It first lists the contents of '/Root' to show the folder's existence, then removes it, and finally lists the contents again to confirm the deletion. ```bash $ megatools ls /Root /Root /Root/MyNewFolder $ megatools rm /Root/MyNewFolder $ megatools ls /Root /Root ``` -------------------------------- ### Register New Mega.nz Account (Shell) Source: https://xff.cz/megatools/man/megatools-reg Initiates the registration of a new Mega.nz account. This command requires email, real name, and password. It creates a non-verified account and may output a verification command for scripting. Dependencies include the 'megatools' executable. ```shell $ megatools reg --register --email your@email.com --name "Your Name" --password "Your Password" ``` -------------------------------- ### Verify Mega.nz Account (Shell) Source: https://xff.cz/megatools/man/megatools-reg Completes the Mega.nz account registration by verifying it using a state token and a verification link obtained from an email. This command is essential after the initial registration step. Dependencies include the 'megatools' executable. ```shell $ megatools reg --verify vbFFFv7AFM25etzkFXLs9A==:Z7FFbgAAAAAAAAAArL33eA==:inEONh3tmwY \ 'https://mega.nz/#confirmciyfWXRGFNcM...' ``` -------------------------------- ### megatools df - Show Cloud Storage Space Source: https://xff.cz/megatools/man/megatools-df The `megatools df` command allows you to view your cloud storage's total, used, or free space. It supports both machine-readable and human-readable output formats. ```APIDOC ## GET /cloud/df ### Description Retrieves information about the total, used, or free space available in your Mega.nz cloud storage. The output can be formatted for scripts or for easy human reading. ### Method GET ### Endpoint `/cloud/df` ### Query Parameters - **--free** (flag) - Optional - Show only the free space. - **--total** (flag) - Optional - Show only the total available space (free + used). - **--used** (flag) - Optional - Show only the used space. - **--mb** (flag) - Optional - Display sizes in MiB units. - **--gb** (flag) - Optional - Display sizes in GiB units. - **-h**, **--human** (flag) - Optional - Display file sizes in a human-readable format (e.g., KiB, MiB, GiB). - **-u**, **--username** (string) - Optional - Your Mega.nz account email. - **-p**, **--password** (string) - Optional - Your Mega.nz account password. - **--no-ask-password** (flag) - Optional - Never prompt for the password interactively. - **--reload** (flag) - Optional - Force a reload of the filesystem cache before retrieving space information. - **--limit-speed** (number) - Optional - Set the maximum upload and download speed in KiB/s. `0` means no limit. - **--proxy** (string) - Optional - Use a proxy server. Acceptable values include `none`, `socks5://localhost:9050`, `socks5h://localhost:9050`, or a URL. - **--netif** (string) - Optional - Specify the network interface or local IP address for outgoing connections. - **--ip-proto** (string) - Optional - Prefer IPv4 (`v4`), IPv6 (`v6`), or any (`any`) protocol for connecting. - **--config** (string) - Optional - Path to a custom configuration file. - **--ignore-config-file** (flag) - Optional - Ignore the default `.megarc` configuration file. - **--debug** (string) - Optional - Enable debugging. Can take comma-separated options like `api,fs`. - **--version** (flag) - Optional - Display the megatools version information. ### Request Example ```bash megatools df -h ``` ### Response #### Success Response (200) - **Total** (string) - The total available cloud storage space. (e.g., "50.0 GiB") - **Used** (string) - The amount of cloud storage space currently used. (e.g., "6.4 GiB") - **Free** (string) - The amount of free cloud storage space remaining. (e.g., "43.6 GiB") #### Response Example ```json { "Total": "50.0 GiB", "Used": "6.4 GiB", "Free": "43.6 GiB" } ``` ### Known Bugs - For premium accounts, `megatools df` cannot accurately determine the available space. ``` -------------------------------- ### Test File/Folder Existence on Mega.nz Source: https://xff.cz/megatools/man/megatools-test This command tests if a specified path on Mega.nz exists. It returns an exit code of 0 if the path is found, 1 if not found, and 2 if the path exists but does not match the specified file (-f) or folder (-d) type. Other errors result in a status code of 3. ```bash megatools test /Root/README test $? -eq 0 && echo "File or folder exists at /Root/README" ``` ```bash megatools test -f /Root/file1 /Root/file2 test $? -eq 0 && echo "/Root/file1 and /Root/file2 are both files" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.