Requested by dex1983 (IRC)
Code:
/*
On package finished, if the package does not contain archives, move files to user-specified location
Trigger: Package finished
*/
var myFolder = "/path/to/folder"; //<- set destination path
if (!package.getArchives().length) {
package.getDownloadLinks().forEach(function(link) {
getPath(link.downloadPath).moveTo(myFolder);
})
}
Code:
/*
On package finished, move files to user-specified location
Trigger: Archive extraction finished
*/
var myFolder = "/path/to/folder", //<- set destination path
links = archive.getDownloadLinks();
if (links) {
var package = links[0].package;
if (package.finished) {
package.getDownloadLinks().forEach(function(link) {
if (link.getArchive()) {
archive.getExtractedFilePaths().forEach(function(file) {
file.moveTo(myFolder);
})
} else {
getPath(link.downloadPath).moveTo(myFolder);
}
})
}
}