View Single Post
  #811  
Old 28.06.2019, 15:35
the Dark the Dark is offline
DSL Light User
 
Join Date: May 2010
Posts: 31
Default

Quote:
Originally Posted by mgpai View Post
Delete files at specified interval:
Code:
// Delete downloaded files from user-specified folder, at user-specified interval.
// Trigger : Interval (300000)

var myFolder = "/as/example/deletefilesfolder"; // <- case-sensitive

getAllDownloadLinks().forEach(function(link) {
    if (!link.isFinished()) return;
    var file = getPath(link.getDownloadPath());
    if (!file.exists()) return;
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) file.delete();
})

Delete files immediately after downloading (Recommended):
Code:
// Delete downloaded files from user-specified folder, immediately after it's been downloaded.
// Trigger : A Download Stopped

var myFolder = "/as/example/deletefilesfolder"; // <- case-sensitive

if (link.isFinished()) {
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) {
        var file = getPath(link.getDownloadPath());
        file.delete();
    }
}
Sorry this is the script now but I can not make it work

Code:
// Enable Folder Watch on user specified dates
// Trigger : Interval

var dates = [1, 16]; // <- Set dates
var watchfolder = "/watchfolder/dir";
var myFolder = "/downloadfolder/delete/after/download"; // <- case-sensitive
var currentStatus = callAPI("extensions", "isEnabled", folderWatch);
var desiredStatus = dates.indexOf(new Date().getDate()) > -1;

if (currentStatus != desiredStatus) callAPI("extensions", "setEnabled", folderWatch, desiredStatus);

if sourceurl(s) contains : file:/*.dlc;
then set... Download Directory: /downloadfolder/delete/after/download;

// Delete downloaded files from user-specified folder, immediately after it's been downloaded.
// Trigger : A Download Stopped

if (link.isFinished()) {
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) {
        var file = getPath(link.getDownloadPath());
        file.delete();
    }
}
Is there also an option to not move the laoded *.dlc into a subfolder "added" ?

Last edited by the Dark; 28.06.2019 at 15:39.
Reply With Quote