megatools-test(1)

πŸ’– megatools-test β€” the vibe check for your Mega.nz files πŸ’–

okay so bestie, welcome to megatools-test(1) from the megatools manual set 🫢 this little icon is literally just here to answer one question: does this thing exist or not ✨


🌸 NAME 🌸

megatools test β€” test for existence of files or folders. no cap, that's the whole job πŸ’…


✨ SYNOPSIS ✨

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

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically this tool tests for existence of files or paths of files stored on Mega.nz. that's it, that's the assignment πŸŽ€

The exit codes are giving very structured, very main character:

  • 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 πŸ™ˆ

πŸ‘‘ OPTIONS πŸ‘‘

  • --file, -f β€” require all <remotepaths> to be files. every single one. periodt πŸ“„
  • --folder, -d β€” require all <remotepaths> to be folders. all of them or nothing bestie πŸ“
  • -u <email>, --username <email> β€” account username (email). it's giving login energy ✨
  • -p <password>, --password <password> β€” account password. keep it secret, keep it safe 🀫
  • --no-ask-password β€” never ask interactively for a password. it just will not do the asking thing πŸ™…
  • --reload β€” reload filesystem cache. refresh, bestie, refresh πŸ”„
  • --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. okay so important detail: each transfer gets its own limit, iykyk πŸƒ
  • --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. yes that's a real caveat, read it twice 🌈
  • --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. it's a suggestion, not a demand πŸ’…
  • --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.

πŸŽ€ 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

see, both files, both exist, both slay ✨


🌈 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. okay noted 🫑

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. πŸ’€ (yes, the manual literally says "Not sure." iconic honestly)
  • /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.

πŸ’œ 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).

the whole friend group fr fr 🫢


🌟 MEGATOOLS 🌟

Part of the megatools(1) suite of commands. yes, it's in the group chat πŸ‘‘


😭 BUGS 😭

There is no upstream support for bugreports and feature requests. but you can send code patches to megatools@xff.cz ⟨mailto:megatools@xff.cz⟩ to get them integrated into upstream repository. so like, bring solutions not problems bestie πŸ’…


⭐ AUTHOR ⭐

Megatools was written by Ondrej Jirman < megatools@xff.cz ⟨mailto:megatools@xff.cz⟩ >, 2013-2022.

Official website is ⟨https://xff.cz/megatools/⟩.


and that's the whole page babes πŸ’– this was megatools-test(1), dated 11 July 2025, and it's part of the megatools manual set β€” go test some paths, you got this πŸŒΈπŸ¦‹πŸŽ€

πŸ“¦ where this page comes from