Basically traversing the entire folder structure. for example, I have a music folder with albums as folders. I also have other miscellaneous songs in the music folder as well.
I have this but it only picks up the other music files and gives me a FileNotFoundException
, with the reason being that access is denied to other album folders
File[] files = new File("C:/Users/Mayank/Desktop/Music/").listFiles();
private class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent arg0) {
int check = (int) (Math.random()* files.length);
isPlaying = false;
mp3.close();
mp3 = new MP3(files[check].getPath());
mp3.play();
isPlaying = true;
}
EDIT: I see its a duplicate. thanks brain!