Copy remote folder in local

Hello, I’m using the plugin file for download automatically one folder to the computer and make some check, the case is if I have the folder froms erver, I can get prefectly the folder with this instruction:

var serverReports = plugins.file.getRemoteFolderContents("/" + folderReports, null, 2);

But when i want to copy every folder inside the destination folder with this other instruction:

plugins.file.copyFile(serverReports*, plugins.file.getHomeFolder() + "/");*
*```*
*And i try to do this too:*
*```*
*var folderReport = plugins.file.getRemoteFolderContents(serverReports[i], null, 1);
application.output(plugins.file.copyFolder(folderReport[0], plugins.file.getHomeFolder() + "/"));*
*```*
*But don't work, i dont' know how much more to do*
*return me false, and not copy anything. Any idea what i can do wrong? thanks for all*

The copyFolder and copyFile methods don’t work on Remote JSFile.

  • you are mixing remote (relative) paths with local (absolute) paths.

One way to do that what you want is to launch a headless client (this will then run on the server), and that headless will then do copyFolder and copyFile on local JSFiles.

But with the headless client is so much complicated, no? are any form instead of copy, created the file, and adding from the array i have?