def upload(field=None): sources = ctx.field("sources").stringValue().split("\n") target = ctx.field("target").stringValue() if not sources or not target: return if not target[-1] == "/": target += "/" winsources = [] for source in sources: winsources.append(MLABFileManager.nativePath(source)) script = _getScript() commands = ctx.field("preCommand").stringValue().split(";") for command in commands: if command: script += command + "\n" script += "put \"" + "\" \"".join(winsources) + "\" \"" + target + "\"\n" commands = ctx.field("postCommand").stringValue().split(";") for command in commands: if command: script += command + "\n" script += "close\nexit\n" _executeScript(script)
def download(field=None): sources = ctx.field("sources").stringValue().split("\n") target = ctx.field("target").stringValue() if not sources or not target: return ctx.field("transferring").value = 1 if not target[-1] == "\\": target += "\\" target = MLABFileManager.nativePath(target) for source in sources: script = _getScript() script += "get \"" + source + "\" \"" + target + "\"\n" script += "close\nexit\n" _executeScript(script)