Exporting to an Archive
Use the mlcp export
command with an output type of archive
to create a database archive that includes content and metadata. You can use the mlcp import
command to copy the archive to another database or restore database contents.
To export database content to an archive file with mlcp:
Select the documents to export. For details, see Filtering Archive and Copy Contents.
To select documents in one or more collections, set
-collection_filter
to a comma separated list of collection URIs.To select documents in one or more database directories, set
-directory_filter
to a comma separated list of directory URIs.To select documents matching an XPath expression, use
-document_selector
. To use namespace prefixes in the XPath expression, define the prefix binding using-path_namespace
.To select documents matching a query, use
-query_filter
, alone or in combination with one of the other filter options. False positives are possible; for details, see Understanding When Filters Are Accurate.To select all documents in the database, leave
-collection_filter
,-directory_filter
,-document_selector
, and-query_filter
unset.
Set
-output_file_path
to the destination directory on the native filesystem. This directory must not already exist.Set
-output_type
toarchive
.If you want to exclude some or all document metadata from the archive:
Set
-copy_collections
tofalse
to exclude document collections metadata.Set
-copy_permissions
tofalse
to exclude document permissions metadata.Set
-copy_properties
tofalse
to exclude document properties.Set
-copy_quality
tofalse
to exclude document quality metadata.Set
-copy_metadata
tofalse
to exclude document key-value metadata.
For a full list of export options, see Export Command Line Options.
The following example exports all documents and metadata to the directory /space/examples/exported
. After export, the directory contains one or more compressed archive files.
# Windows users, see Modifying the Example Commands for Windows $ mlcp.sh export -host localhost -port 8000 -username user \ -password password -mode local \ -output_file_path /space/examples/exported -output_type archive
The following example exports only documents in the database directory /plays/
, including their collections, properties, and quality, but excluding permissions:
# Windows users, see Modifying the Example Commands for Windows $ mlcp.sh export -host localhost -port 8000 -username user \ -password password -mode local \ -output_file_path /space/examples/exported -output_type archive \ -copy_permissions false -directory_filter /plays/
You can use the mlcp import
command to import an archive into a database. For details, see Loading Content and Metadata from an Archive.