Check hidden file java

Check hidden file java

In below sample you will see how to check if file is hidden using java program:

  • CheckHiddenFileJava.java
package com.javahonk;

import java.io.File;

public class CheckHiddenFileJava {

	public static void main(String[] args) {
		
		File file = new File("C:\\SYSTEM.SAV");
		if (file.exists()) {
			System.out.println("File hidden: "+file.isHidden());
		}else {
			System.out.println("File does not exits");
		}
	}

}
  • Output:

2014-12-22_2337

  •  For more information about file api please refer oracle tutorial here

Leave a Reply

Your email address will not be published. Required fields are marked *