Hello,
it is possible to set up a rule to finde the 5 newest files in a directory and save the complete pathname to a list?
thanks a lot
Hello,
it is possible to set up a rule to finde the 5 newest files in a directory and save the complete pathname to a list?
thanks a lot
Done - not nice, but working
var String PathImages = "C:\\temp"
var Integer CountImages = 2
var File directory = new File (PathImages)
var File[] listOfFiles = directory.listFiles()
val List<String> attachmentUrlList = newArrayList()
attachmentUrlList.clear()
var File[] SendFiles = listOfFiles.sortBy[lastModified].take(CountImages)
SendFiles.forEach [x |
var String PathString = "file:" + x.path
//logWarn(PathString, PathString)
var String FileString = PathString.replace("\\", "/")
logWarn(FileString, FileString)
attachmentUrlList.add(FileString)
]
var String mailSubject = "http://blablabla.net/"
var String mailObject = "Bewegungsalarm!"
sendMail("blabla@gmail.com", mailObject, mailSubject, attachmentUrlList)