package com.swain.cell;
import java.io.IOException;
import
java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class FindFilesInDirectory
{
public static void main(String[] args)
{
Path
dir = Paths.get("c:\\JAVA");
try
(DirectoryStream<Path> stream = Files.newDirectoryStream(dir,
"*.*")) {
for (Path entry :
stream) {
System.out.println(entry.getFileName());
}
}
catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
No comments:
Post a Comment