megatools-copy(1)
=================

NAME
----
megatools copy - Upload/download entire directories to/from your Mega.nz account


SYNOPSIS
--------
[verse]
'megatools copy' [-n] [--no-progress] [--no-follow] --local <path> --remote <remotepath>
'megatools copy' [-n] [--no-progress] --download --local <path> --remote <remotepath>


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

Copies the contents of a local directory into a remote folder (the
default), or with `--download` the contents of a remote folder into a local
directory, with all subdirectories. The remote folder must exist (create it
with man:megatools-mkdir[1]). The local directory must exist for uploads;
for downloads it is created when it's missing (but not its parents).

Each file and folder that is copied or created is printed as `F <path>` or
`D <path>`.

No files are ever overwritten or removed. A file that is already at the
destination (by name) is skipped, so the same copy can be run again to add
new files or to finish an interrupted one; when its size differs, a warning
says so (changed files are not updated). A folder where a file belongs, or
the other way around, is an error.

When uploading, symbolic links are followed (unless `--no-follow` is given)
and special files (FIFOs, devices, sockets) are skipped.

Mega allows several files or folders with the same name in one folder. When
downloading, the oldest one keeps the name and the others are saved as
`name (1).ext`, `name (2).ext`, ... (names that are already taken by other
files in that folder are skipped).


OPTIONS
-------

-r <remotepath>::
--remote <remotepath>::
	Remote folder.

-l <path>::
--local <path>::
	Local directory.

-d::
--download::
	Download files from Mega.nz. The default is to upload.

-n::
--dryrun::
	Don't change anything, just print what would be copied.

--no-follow::
	Skip symbolic links when uploading, instead of uploading the files and
	directories they point to.

--no-progress::
	Disable transfer progress reporting.

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


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

0 when everything was copied (or skipped because it was already there),
1 when something failed.


EXAMPLES
--------

* Upload a directory:
+
------------
$ megatools mkdir /Root/Backups
$ megatools copy --local MyBackups --remote /Root/Backups
F /Root/Backups/notes.txt
D /Root/Backups/2025
F /Root/Backups/2025/photo.jpg
------------


* See what would be uploaded after adding files, then upload them:
+
------------
$ megatools copy -n --local MyBackups --remote /Root/Backups
F /Root/Backups/2025/new.jpg
$ megatools copy --local MyBackups --remote /Root/Backups
------------


* Download a folder:
+
------------
$ megatools copy --download --local MyBackups --remote /Root/Backups
------------


include::remote-paths.txt[]

include::footer.txt[]
