diff --git a/core/language/en-GB/Help/savetiddlers.tid b/core/language/en-GB/Help/savetiddlers.tid index 61b9ba30e..e327ceec3 100644 --- a/core/language/en-GB/Help/savetiddlers.tid +++ b/core/language/en-GB/Help/savetiddlers.tid @@ -4,9 +4,11 @@ description: Saves a group of raw tiddlers to a directory Saves a group of tiddlers in their raw text or binary format to the specified directory. ``` ---savetiddlers +--savetiddlers [-do-not-delete] ``` By default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory. +The output directory is cleared of existing files before saving the specified files. The deletion can be disabled by specifying the ''-do-not-delete'' flag. + Any missing directories in the pathname are automatically created. diff --git a/core/modules/commands/savetiddlers.js b/core/modules/commands/savetiddlers.js index e7bd9e901..fdb5940c1 100644 --- a/core/modules/commands/savetiddlers.js +++ b/core/modules/commands/savetiddlers.js @@ -35,8 +35,11 @@ Command.prototype.execute = function() { wiki = this.commander.wiki, filter = this.params[0], pathname = path.resolve(this.commander.outputPath,this.params[1]), + dontDelete = (this.params[2] || "").toLowerCase() === "-do-not-delete", tiddlers = wiki.filterTiddlers(filter); - $tw.utils.deleteDirectory(pathname); + if(!dontDelete) { + $tw.utils.deleteDirectory(pathname); + } $tw.utils.createDirectory(pathname); $tw.utils.each(tiddlers,function(title) { var tiddler = self.commander.wiki.getTiddler(title),