Java examples for File Path IO:File Attribute
Call the Files.isHidden() method.
import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { Path path = FileSystems.getDefault().getPath( "C:/folder1/folder2/folder4", "my.txt"); try {//from w w w . j a v a2 s. c o m boolean is_hidden = Files.isHidden(path); System.out.println("Is hidden ? " + is_hidden); } catch (IOException e) { System.err.println(e); } } }