JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy

How to Check Hidden File in Java?

November 8, 2013 by Krishna Srinivasan Leave a Comment

If you want to check if a file is hidden or not. Then use the below code snippet. The method isHidden() in the File class is used for checking if the file is hidden or not. This is simple utility which is useful when you are working with the File operations.

[code lang=”java”]
package javabeat.net.io;

import java.io.File;
import java.io.IOException;

public class HiddenCheck {
public static void main(String[] args) throws IOException
{
File file = new File("d:\\CreateFile.txt");

if(file.isHidden()){
System.out.println("This is a hidden file");
}else{
System.out.println("This file is not hidden");
}
}
}
[/code]

Filed Under: Java Tagged With: Java IO

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved