megatools-test(1)


Table of Contents

1. NAME
2. SYNOPSIS
3. DESCRIPTION
4. OPTIONS
5. EXAMPLES
6. REMOTE FILESYSTEM
7. SEE ALSO
8. MEGATOOLS
9. BUGS
10. AUTHOR

1. NAME

megatools test - Test for existence of files or folders

2. SYNOPSIS

megatools test [-f|-d] <remotepaths>…

3. DESCRIPTION

Tests for existence of files or paths of files stored on Mega.nz.

If all <remotepaths> match the condition, the tool returns status code 0.

If one of the <remotepaths> doesn’t exist, the tool returns 1.

If one of the <remotepaths> doesn’t match the -f or -d filter, the tool returns 2.

For other errors, the tool returns 3.

4. OPTIONS

--file , -f
Require all <remotepaths> to be files.
--folder , -d
Require all <remotepaths> to be folders.
-u <email> , --username <email>
Account username (email)
-p <password> , --password <password>
Account password
--no-ask-password
Never ask interactively for a password
--reload
Reload filesystem cache
--limit-speed <speed>
Set maximum allowed upload and download speed in KiB/s. This option overrides config file settings. 0 means no limit. When using ParallelTransfers > 1, upload speed limit is applied to each transfer individually.
--proxy <proxy>

Use proxy server to connect to mega.nz. This option overrides config file settings. More information can be found in libcurl documentation at https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html. Some acceptable values are:

  • none : Disable proxy if it was enabled in the config file.
  • socks5://localhost:9050 : Local SOCKSv5 proxy server
  • socks5h://localhost:9050 : Local SOCKSv5 proxy server with DNS handled by the proxy
--netif <ifname|ip>
Network interface or local IP address used for outgoing connections. You have to specify IP address bound to some of your local network interfaces, when specifying an IP address.
--ip-proto <proto>
Which IP protocol to prefer when connecting to mega.nz (v4, v6, or any). This is just an advisory option. Megatools will resolve mega.nz domain, and then use an A or AAAA record based on the stated preference.
--config <path>
Load configuration from a file
--ignore-config-file
Disable loading .megarc
--debug [<options>]

Enable debugging of various aspects of the megatools operation. You may enable multiple debugging options separated by commas. (eg. --debug api,fs)

Available options are:

  • http: Dump HTTP request/response details (can be used to debug connection/proxy issues)
  • api: Dump Mega.nz API calls
  • fs: Dump Mega.nz filesystem (may require --reload to actually print something)
  • cache: Dump cache contents
  • tman: Dump transfer manager events
--version
Show version information
<remotepaths>
One or more remote filesystem paths to test.

5. EXAMPLES

  • Test for existence of a path:

    $ megatools test /Root/README
    $ test $? -eq 0 && echo "File or folder exists at /Root/README"
    File or folder exists at /Root/README
  • Test for existence of multiple files:

    $ megatools test -f /Root/file1 /Root/file2
    $ test $? -eq 0 && echo "/Root/file1 and /Root/file2 are both files"
    /Root/file1 and /Root/file2 are both files

6. REMOTE FILESYSTEM

Mega.nz filesystem is represented as a tree of nodes of various types. Nodes are identified by a 8 character node handles (eg. 7Fdi3ZjC). Structure of the filesystem is not encrypted.

Megatools maps node tree structure to a traditional filesystem paths (eg. /Root/SomeFile.DAT).

NOTE: By the nature of Mega.nz storage, several files in the directory can have the same name. To allow access to such files, the names of conflicting files are extended by appending dot and their node handle like this:

/Root/conflictingfile
/Root/conflictingfile.7Fdi3ZjC
/Root/conflictingfile.mEU23aSD

You need to be aware of several special folders:

/Root
Writable directory representing the root of the filesystem.
/Trash
Trash directory where Mega.nz web client moves deleted files. This directory is not used by megatools when removing files.
/Inbox
Not sure.
/Contacts
Directory containing subdirectories representing your contacts list. If you want to add contacts to the list, simply create subdirectory named after the contact you want to add.
/Contacts/<email>
Directories representing individual contacts in your contacts list. These directories contain folders that others shared with you. All shared files are read-only, at the moment.

7. SEE ALSO

megatools(1), megarc(5), megatools-df(1), megatools-dl(1), megatools-get(1), megatools-ls(1), megatools-mkdir(1), megatools-put(1), megatools-reg(1), megatools-rm(1), megatools-copy(1).

8. MEGATOOLS

Part of the megatools(1) suite of commands.

9. BUGS

Report bugs to megatools@megous.com. Your message will end up in a public archive, so be careful what you say or send.

10. AUTHOR

Megatools was written by Ondrej Jirman <megatools@megous.com>, 2013-2022.

Official website is http://megatools.megous.com.