Please see the below code ,basically i am checking some specific word in filename to determine the type of file.Please see the below code and leet me know if this is the best way otherwise please suggest.
Example File Name : incoming_EMP_data.dat
final String[] files = file.list();
if (files != null && files.length > 0) {
fileName = files[0];
if(files[0].replace("_"," ").indexOf("EMP")!=-1)
System.out.println("EMP file");
else
System.out.println("NOT EMP file");
}
if file name has incoming_TEMP_data.dat also above code will pass,I am looking exact word ,
Regards,
mkr