Get file name from folder
Hi all,
how to find a .txt file in a particular folder. My text file comes with
following name <fixed_name>.<mmddyy><hhmmss>, e.g., fn_fnprod.102806015605
so how to get this file name. nd also tell me if there are multiple files
then how to retrieve the oldest one first and so on....
Thanks & Regards
Gaurav
[373 byte] By [
HCLitsa] at [2007-10-3 10:23:28]

look at the File API.
File f = new File("folderpath");
File[] fList = f.listFiles();
//loop here
for(int i = 0; i < fList.length ; i+;){
f[i].getName();
}
> it's fine but how to know which is older file b'cpz
> this file comes every day with new date & time. so
> what if there a multiple file. nd i have proceed
> oldest first.
> pls help asap
get each file last modifed, using file.lastModified() method and compare which file you would be needing. =)