The idea is to take one single file, but I don't want to list all the files, I have the address of the specified folder, but not the name.
Basically I want
findFileInFolder(String folderName) --- this method returns a random filename or the oldest file created on the folder
Does anybody ever tryied doing this? any Ideas to avoid listing all the files in an array and then taking the firstone?
Added:
Just in case I wasn't clear (I'm really sorry for my english, please forgive me if I sound prepotent or agressive is really not in my intentions) the file is not selected by a human, it's selected by the machine not even asking or showing the file except for the method that returns a string with the FileName
String findFileInFolder(String folderName)
Like I comment is for ussage of ram and proccesor, because this is a secondary proccess and not the primary of the proyect, so if I have to read over a thousand files it will considerably reduce the performance of my proyect :(
Thanks ;)
New add, the program is running on different computers so if I could just access the directory not "thinking" about reading wich file it would be great =D
Hopefully last add, sorry for bothering you guys :)
for what I read on the answers there is no way, so my question is, what good alternatives instead of doing an array would you think? my idea was making an index in a textfile and taking only the first line.