megatools-test(1)
=================

NAME
----
megatools test - Test for existence of files or folders


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


DESCRIPTION
-----------

Tests whether files or folders exist on Mega.nz, for use in scripts. Nothing
is printed, the result is the exit status.


OPTIONS
-------

--file::
-f::
	Require all `<remotepaths>` to be files.

--folder::
-d::
	Require all `<remotepaths>` to be folders (/Root, /Trash and /Shared
	count as folders too).

include::auth-options.txt[]
include::basic-options.txt[]

<remotepaths>::
	One or more remote filesystem paths to test.


EXIT STATUS
-----------

0::
	All `<remotepaths>` exist (and match `-f` or `-d`).

1::
	One of the `<remotepaths>` doesn't exist.

2::
	All exist, but one of them doesn't match the `-f` or `-d` filter.

3::
	Another error (bad options, login failed, ...).

EXAMPLES
--------

* Test for existence of a path:
+
------------
$ megatools test /Root/README && 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 && echo "/Root/file1 and /Root/file2 are both files"
/Root/file1 and /Root/file2 are both files
------------


* Create a folder only when it's missing:
+
------------
$ megatools test -d /Root/Backups || megatools mkdir /Root/Backups
------------


include::remote-paths.txt[]

include::footer.txt[]
