Skip to content

Instantly share code, notes, and snippets.

@level09
Created September 30, 2013 22:45
Show Gist options
  • Save level09/6771422 to your computer and use it in GitHub Desktop.
Save level09/6771422 to your computer and use it in GitHub Desktop.
import java.io.File;
public class ListFiles
{
public static void main(String[] args)
{
// Directory path here
String path = ".";
String files;
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
files = listOfFiles[i].getName();
System.out.println(files);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment