• Post Reply Bookmark Topic Watch Topic
  • New Topic

get number of files  RSS feed

 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File f = new File("path_to_directory");
String[] list = f.list();

can i get all non directories using above two line.help me.
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use isDirectory() method of java.io.File class.
it will return a boolean value.
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use listFiles() in combination with a FileFilter whose accept method returns true if the file is not a directory.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!