|
Hidden File
The following example shows how to check whether the given file is hidden.
|
package com.bethecoder.tutorials.io;
import java.io.File;
public class HiddenFileTest {
/**
* @param args
*/
public static void main(String[] args) {
File file = new File("C:\\file_ops.txt");
if (file.isHidden()) {
System.out.println(file + " is a hidden file");
} else {
System.out.println(file + " is not a hidden file");
}
file = new File("C:\\hidden_file.txt");
if (file.isHidden()) {
System.out.println(file + " is a hidden file");
} else {
System.out.println(file + " is not a hidden file");
}
}
}
|
| |
It gives the following output,
C:\file_ops.txt is not a hidden file
C:\hidden_file.txt is a hidden file
|
|