For Marklogic version below 6.0 on different platforms, XQSync is a tool that can copy documents and their metadata between databases, package documents and their metadata as zip archives, or write them directly to a filesystem. It deals with an entire database, a collection, a directory, or the results of evaluating an XQuery expression. If you're using Marklogic version 6.0 and above, the way to do this is to use a new Marklogic supported tool named mlcp.
As part of Marklogic 6.0 release, a new Marklogic Supported tool named Marklogic Content Pump (mlcp) let you copy/move/migrate/shift data from one Marklogic server to another. If you're using Marklogic below version 6.0, the way to do this is to use XQsync to import/export Marklogic documents and metadata.