• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a directory and getting the filename

 
Norazanita Adnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Ive been trying to figure out how can I read retrieve each filename of the files from the directory into my code. now i'm able to read the directory using the

but now i need the filename and put it the the stringArray.

thanks!
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File.listFiles() is the method you require.
getName gives the name of the file without the path.
 
Norazanita Adnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks...
it help me so much
thanks once again..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!