how to get files by older date of modification

Hi community,
please i need to know how to get files from folder by theire oldest modification date.

Regards,

Hi – I don’t think any built-in service exist to serve this purpose. You have to write some java code like below to get the work done.

File files = directory.listFiles();

Arrays.sort(files, new Comparator(){
public int compare(File f1, File f2)
{
return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
} });

Thanks,

HI MR as173d thank you for ye reply,

i didn’t develop anything, i think that pub.client.sftp:get do that for me it get the oldest file first and so on.

Regards,

Cool, your task is done :). I used it long time ago so could not able to remember properties of get as part of sftp :slight_smile:

Thanks,

make sense:)