Microsoft Visual J++. Java


- 2


//

File fdir = new File(sDirPath);

 

// ,

//

if(!fdir.exists())

{

System.out.println("Directory not found: "

+ sDirPath);

}

// ,

//

else

{

// ,

if(!fdir.isDirectory())

System.out.println("File " + sDirPath +

" is not directory");

 

// ,

else

{

// , list

//

if(sMask == null)

dirlist = fdir.list();

// list,

else

dirlist = fdir.list(new MaskFilter(sMask));

 

//

for (int i = 0; i < dirlist.length; i++)

{

// ,

// , File

File f = new File(sDirPath + "\\" + dirlist[i]);

//

if(f.isFile())

System.out.println(dirlist[i].toLowerCase());

//

else

System.out.println(dirlist[i]);

}

}

}

System.out.println("Press <Enter> to terminate...");

System.in.read(bKbdInput);

}

catch(Exception ioe)

{

System.out.println(ioe.toString());

}

}

}

 

// =========================================================

// MaskFilter

//

// =========================================================