• Post Reply Bookmark Topic Watch Topic
  • New Topic

Get directory listings from a location and display it inside Listbox.  RSS feed

 
Jahed Hossain
Greenhorn
Posts: 11
Firefox Browser Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been trying to just make this work but.. I am trying to get the directory listings of a path and then use that to search for files that starts with ".mbf" extension into a String array and then set the ListBox Items to that String array.

I'd be grateful if you give me an example of your own solving my problem than try and fix this[/b]:

1. Create ListBox
2. Store directoryListings of "./backup" in a String array
3. Sort through the array and select only the ones with ".mbf" extension and save it into a new array
4. Set the ListBox's Items to the data in the new array.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You aren't likely to get someone to post completed code here, because the Ranch is NotACodeMill (<- click link). But we can help. For example, if I were you I would probably use the Files#walkFileTree() method with a visitor that checks the name of the file being visited, and if it matches the extension you want, puts it in an array.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!