/*
This program will help you to display only Mp3 files in the given folder.
Author: Afiz
*/
import java.io.File;
class ListMP3Files
{
public static void main(String[] args) // Main method
{
String path = ".."; // Directory path here
String files;
File folder = new File(path);
File[] listOfFiles = folder.listFiles(); // get files in the array
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
files = listOfFiles[i].getName();
if (files.endsWith(".mp3") || files.endsWith(".MP3"))
{
System.out.println(files);
}
}
}
}
}
0 Comments