mindtouch.import.exe is a command line tool for exporting, importing and copying pages from a MindTouch-powered site. The import/export operations use the API over HTTP(s) and can be performed from any machine with access to the site.
A copy of mindtouch.import.exe is included with your MindTouch installation in the same folder as mindtouch.host.exe. If you do not have access to it, you may also download the most recent version from here.
Table of Contents
|
MindTouch 9.08 or later
.NET 3.5/Mono 2.4 or later
The tool can perform one of three actions: export, import, or copy.
Note: If the genconfig option is specified, the provided arguments are used to generate an xml configuration file that can be used to excecute the specified command using the config option. Regardless of whether the documents to export is specified by the exportpath option, an external exportlist or exportdoc, the generated configuration file will have embedded the loaded or created export document inside the config file.
Example: Export entire site starting at the root as zip archive, mywiki.zip. This will prompt for user and password.
mindtouch.import -e -h mywiki.com -r mywiki.zip
mindtouch.import uses the MindTouch import/export facilites, requiring an export manifest to define what subset of the site to export. In order to simplify this process mindtouch.import provides several ways to define the export manifest.
To export a single page the exportpath option should be used. In order to export a hierarchy, i.e. a page with all it's children and dependents the recursive flag needs to be defined as well.
Note: Copy and Export presents a special case in which exportpath can be omitted, forcing it to default to the same values as exportreltopath, i.e. '-X /foo' means "export /foo, relative to /foo". Omitting exportreltopath as well uses the default value of /, i.e. exporting the root of the site, and with recursive defined, the entire site.
If more than a single page or hierachy needs to be exported, exportlist needs to be used instead. exportlist expects a path to a text file containing a list of URIs or paths (must start with a / ). Each path/URI defines a page or page hierarchy depending on whether the recursive flag is defined. The list can contain comments (lines starting with # ) and blank lines.
Example list:
# here's a path /foo/baz # here's a URIs http://mywiki.com/foo/bar # index.php style Uri's are also valid http://mywiki.com/index.php?title=foo/%26_some_strange_name
Finally, if the previous two methods are too limiting, the export manifest can be specified manually per the specification.
Example: Import a zip archive of a wiki under /backup. This will prompt for user and password.
mindtouch.import -h mywiki.com -I /backup mywiki.zip
Note: In the case of import the [target] can also be a URI to the package, i.e. the following is also legal usage of import
mindtouch.import -h mywiki.com -I /backup http://mindtouch.com/packages/mypackage.zip
Copy can only be used to copy content within a single MindTouch instance. In order to copy content from one instance to another, a separate export and import must be used.
Note: Copy and Export presents a special case in which exportpath can be omitted, forcing it to default to the same values as exportreltopath, i.e. '-X /foo' means "export /foo, relative to /foo".
Example: Recursively copy a subtree within a site from /staging to /production. This will prompt for user and password.
mindtouch.import -c -h mywiki.com -X /staging -I /production -r
All options can be specified either on the command line or in an xml configuration file. Both methods can be used together, i.e. the configuration file could contain the authentication information, so that it isn't part of the command line, while the remaining options are specified on the command line.
The format of the configuration file uses attributes for each commandline option. Any option-attributed omitted is treated just like an omitted command line option. In addition the exportdoc option can be omitted and the export document inlined directly:
<config export='(true|false)'
copy='(true|false)'
config='{path}'
host='{host}'
uri='{uri}'
archive='(true|false)'
importreltopath='{path}'
importrelto='{id}'
exportreltopath='{path}'
exportrelto='{id}'
exportdoc='{path}'
exportpath='{path}'
recursive='(true|false)'
authtoken='{token}'
user='{username}'
password='{password}' >
<!-- the archive/directory target. For export or copy operations only -->
<target>{path}</target>
<!--optionally inlined export document-->
<export>
...
</export>
</config>
Running the tool without any command line options prints the usage instructions.
USAGE: mindtouch.import.exe [options] [target]
[target] is either a path to a directory or a filepath ending in .mtarc or .mtapp
(not used for copy operations)
Options:
(Options must be prefixed by a '-' or '/')
Modes: Import (default), Export or Copy
e|export - export mode
c|copy - copy mode
General:
?|usage - display this message
C|config <path> - confguration xml file (see below)
g|genconfig <path> - instead of executing the command, generate the config file for later execution
h|host <host> - MindTouch host (assumes standard API location)
u|uri <api-uri> - specify the full uri to the API
a|archive - force the target to be treated as an archive file
f|folder - force the target to be treated as a folder
I|importreltopath <path> - relative uri path for import and copy destination
importrelto <id> - relative page id for import and copy destination (alternative to importreltopath)
X|exportreltopath <path> - relative uri path for export and copy source
exportrelto <id> - relative page id for export and copy source (alternative to exportreltopath)
D|exportdoc <filename> - filename of the export xml document for export or copy
L|exportlist <filename> - list of paths or uri's to pages to export (respects 'recursive' flag)
p|exportpath <path> - specifies the uri path to export (in lieu of specifying an export document/list)
r|recursive - export all child documents of 'exportpath' or 'exportlist'
o|output - output file/directory path for import or export
R|retries - Maximum number of retries on import/export item failures (default: 3)
l|preservelocal - mark package to preserve local changes to existing pages on import
O|overwritelocal - mark package to preserve local changes to existing pages on import
(overwrite is the default unless the package has a different value set, in which case
this flag can be used to forces overwrite behavior on import)
s|securityrestriction (public|semipublic|private)
- enforce a page restriction for all imported content
cap <capability-name>[=<capability-value>]
- add a capability requirement for the exported package. The default for capability-value
'enabled'
Authentication:
(if no authentication is provided, the program will prompt for user and password interactively)
A|authtoken <token> - authtoken to use for user authentication
U|user <username> - username for authentication (requires password option
P|password <password> - password for username authentcation
Xml Configuration:
Commandline options can be provided by or augmented with an xml configuration document:
<config [option-longname]='value' ...>
[ <target>{output/input file/dir for import/export}</target> ]
[ <export><!--optionally inlined export document--></export> ]
</config>
Value-less options are booleans and have an xml attribute value of 'true' or 'false'.
The 'genconfig' option creates this configuration document from the provided settings for later use.
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by
I just tried to do an export of a wiki that i can otherwise access via browser. Using mindtouch.import to export the content I get prompted for username and password, which I leave blank (since it is not required) the result is an exception:
MindTouch Import, Copyright (c) 2009 MindTouch Inc.
User:
Password:
ERROR: System.Exception: Unable to authenticate
bei MindTouch.Deki.Tools.Import.Program.Authenticate(Opts opts)
bei MindTouch.Deki.Tools.Import.Program.Main(String[] args)
If I run the import script I receive:
ERROR: System.Exception: Unable to authenticate
in MindTouch.Deki.Tools.Import.ImportProgram.Authenticate(Opts opts)
in MindTouch.Deki.Tools.Import.ImportProgram.Main(String[] args)
I get this error: ERROR: System.Exception: Import failed: xdoc is empty ---> System.InvalidOperationException: xdoc is empty
at MindTouch.Xml.XDoc.Attr (System.String tag, System.String value) [0x00000]
at MindTouch.Xml.XDoc.Attr (System.String tag, Boolean value) [0x00000]
at MindTouch.Deki.Tools.Import.ImportProgram.FixupManifest (MindTouch.Xml.XDoc manifest, MindTouch.Deki.Tools.Import.Opts opts) [0x00000]
at MindTouch.Deki.Tools.Import.ImportProgram.Import (MindTouch.Deki.Tools.Import.Opts opts) [0x00000]
--- End of inner exception stack trace ---
at MindTouch.Deki.Tools.Import.ImportProgram.Import (MindTouch.Deki.Tools.Import.Opts opts) [0x00000]
at MindTouch.Deki.Tools.Import.ImportProgram.Main (System.String[] args) [0x00000]
after I:
# mono mindtouch.import.exe -h mywiki.com -I / mywiki.zip
I am able to authenticate correctly prior to the error. edited 21:34, 1 Nov 2010