file.listFiles() listing and sorting files
in
Programming Questions
•
1 years ago
I am trying to list the contents in a directory in the order of creation.
like you get by using ls -t1r
I found this in the learning section.
DirectoryList \ Learning \ Processing.org
Exerpt:
// This function returns all the files in a directory as an array of File objects
// This is useful if you want more info about the file
File[] listFiles(String dir) {
File file = new File(dir);
if (file.isDirectory()) {
File[] files = file.listFiles();
return files;
} else {
// If it's not a directory
return null;
}
}
Any clues how to implement file.listFiles() to list files in creation in order?
Thank you,
AndrewT
1