List files starting with a specific name using java
Posted
by
user3610075
on Stack Overflow
See other posts from Stack Overflow
or by user3610075
Published on 2014-06-06T15:21:17Z
Indexed on
2014/06/06
15:24 UTC
Read the original article
Hit count: 115
java
i want to list files starting with a name like "Report" from a folder. i found this in google to list all files but i don't how to list file starting with a name. Thank you
File directory = new File("C:\\Users\\kiki\\Downloads");
File[] files = directory.listFiles();
for (int index = 0; index < files.length; index++)
{
//Print out the name of files in the directory
System.out.println(files[index].toString());
}
© Stack Overflow or respective owner