View Single Post
  #1395  
Old 07.06.2020, 10:22
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 74
Default

Quote:
Originally Posted by mgpai View Post
Here is a new script, but if you need help to troubleshoot/fix yours, contact me in JD Chat.

Code:
// Move archive files after extraction
// Trigger: Archive Extraction Finished

var links = archive.getDownloadLinks() || [];
var destinationFolder = "C:/sherbee/check";

links.forEach(function(link) {
    var filePath = getPath(link.getDownloadPath());
    var i = 0;

    while (getPath(destinationFolder + "/" + filePath.getName()).exists()) {
        i++;
        newPath = getPath(link.getDownloadPath().toString().replace(/(.+)(\..+)/, "$1" + i + "$2"));
        getPath(filePath).renameTo(newPath);
        filePath = newPath;
    }

    filePath.moveTo(destinationFolder);
});
The script is very good. But problem now:

When menu-tools-extract files then archive.getDownloadLinks() not there.
How get path(s) from manual open?
I need path for case single file (abc.rar or abc.zip etc) but too for multi file like (abc.001, abc.002) so move can work for manual open too.
Reply With Quote