View Single Post
  #7  
Old 13.10.2019, 22:53
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 642
Default

Quote:
Originally Posted by Demongornot View Post
When I mean undeterminable, I meant that, in order to read said file to check for dupe, it would require to test all possible dates to find the file, from "host.com (script creation date).txt" to "host.com (actual date).txt" and incrementing one (minute at worst, one month at best) at the time, the number of possible combinaisons is too high for that...
While incrementing a number take almost no time or computing power.
You just need to filter results using the download host name.

Code:
var folder = JD_HOME + "/history/";
var host = link.getDownloadHost();

var files = getPath(folder).getChildren().filter(function(file) {
    return file.toString().indexOf(host) > -1;
})

var filesDescending = files.reverse();

This is just FYI. I am not in any way suggesting one method is better than the other.
Reply With Quote