tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Java > IO > Hidden File

Hidden File 

The following example shows how to check whether the given file is hidden.

File Name  :  
com/bethecoder/tutorials/io/HiddenFileTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
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


                    Print

   



Books Recommendation

 
 
bl  br