The File.isHidded()
method checks to see if the file represented by aFile
object is a hidden file. The definition of hidden is varied between operating systems. On UNIX based systems, a file is considered to be hidden when their name begins with a period character ('.'
). On Windows operating system, a file is considered to be hidden if it has been marked hidden in the filesystem.
This File.isHidden()
method returns true
if and only if the file denoted by this File
object is hidden according to the conventions of the underlying platform.
package org.kodejava.io;
import java.io.File;
import java.io.IOException;
public class FileHiddenExample {
public static void main(String[] args) throws IOException {
File file = new File("Hidden.txt");
file.createNewFile();
// We are using the isHidden() method to check whether a file
// is hidden.
if (file.isHidden()) {
System.out.println("File is hidden!");
} else {
System.out.println("File is not hidden!");
}
}
}
If you want to set the file attribute to hidden in Windows operating system you can see it in the following example: How do I set the value of file attributes?
Latest posts by Wayan (see all)
- How do I create a table with multiple header in iText 8? - March 16, 2024
- How do I add Image to a Table in iText 8? - March 11, 2024
- How do I downgrade Android SDK emulator version? - February 12, 2024