Skip to main content

mr group export

Export one or more Groups and their reachable entities to a portable tar archive. Sends POST /v1/groups/export, polls the resulting job until completion, then downloads the tar. Takes one or more Group IDs as positional arguments; each ID becomes a root of the export tree.

The archive format follows the manifest schema v1 (see archive/manifest.go) and is compatible with mr group import on any mahresources instance. Scope and fidelity are controlled by paired --include-* / --no-* flags (subtree, resources, notes, related, group-relations, blobs, versions, previews, series). Schema-definition inclusion (categories, tag defs, group-relation types) can be toggled individually or via the --schema-defs=all|none|selected shortcut. Use --gzip to compress the output and --output <path> (or -o) to write to a file rather than stdout.

By default the command waits for the server-side job to finish before downloading; pass --no-wait to print the job ID and exit immediately so you can poll and download separately.

Usage

mr group export <id> [<id>...]

Positional arguments:

  • <id> (variadic; one or more)

Examples

Export group 42 and its subtree to a tar file

mr group export 42 --output /tmp/trip-2026.tar

Export two roots

mr group export 42 43 --gzip --no-blobs --no-related --output /tmp/shell.tar.gz

Submit the job and print its ID without waiting

mr group export 42 --no-wait

Flags

FlagTypeDefaultDescription
--include-subtreebooltrueinclude all descendant subgroups (default on)
--no-subtreeboolfalsedisable --include-subtree
--include-resourcesbooltrueinclude owned resources (default on)
--no-resourcesboolfalsedisable --include-resources
--include-notesbooltrueinclude owned notes (default on)
--no-notesboolfalsedisable --include-notes
--include-relatedbooltrueinclude m2m related entities (default on)
--no-relatedboolfalsedisable --include-related
--include-group-relationsbooltrueinclude typed group relations (default on)
--no-group-relationsboolfalsedisable --include-group-relations
--include-blobsbooltrueinclude resource file bytes (default on)
--no-blobsboolfalsedisable --include-blobs
--include-versionsbooltrueinclude resource version history (default off)
--no-versionsboolfalsedisable --include-versions
--include-previewsbooltrueinclude resource previews (default off)
--no-previewsboolfalsedisable --include-previews
--include-seriesbooltruepreserve Series membership (default on)
--no-seriesboolfalsedisable --include-series
--include-categories-and-typesbooltrueinclude Category/NoteType/ResourceCategory defs (D1, default on)
--no-categories-and-typesboolfalsedisable --include-categories-and-types
--include-tag-defsbooltrueinclude Tag definitions (D2, default on)
--no-tag-defsboolfalsedisable --include-tag-defs
--include-group-relation-type-defsbooltrueinclude GroupRelationType defs (D3, default on)
--no-group-relation-type-defsboolfalsedisable --include-group-relation-type-defs
--schema-defsstringselectedschema-def shortcut (all
--gzipboolfalsegzip the output tar
--outputstring``output file path (default stdout)
--waitbooltruewait for the job to finish before returning
--no-waitboolfalsereturn immediately after submitting the job
--poll-intervalduration1spolling interval
--timeoutduration30m0smax total wait time
--related-depthint0follow m2m relationships up to N hops deep (0 = off)

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

Tar archive written to stdout or --output path; when --no-wait, prints the job ID as plain text

Exit Codes

0 on success; 1 on any error

See Also