HOME      BLOG       FORUMS      CONTACT       ABOUT

Checks whether a file or directory has executable permission or not.

Checks whether a file or directory has executable permission or not.

The canExecute method of File class can be used for finding out whether the given file has executable permission or not.

import java.io.File;
/**
 * File class examples.
 *
 */
public class FileExample  {
	public static void main(String[] args){
		// Create file object representing the source file/directory
		File file = new File("d:\\temp");

		// Check whether the file has executable permission or not.
		boolean value = file.canExecute();

		System.out.println("File executable permission status : "+value);
	}
}

Share

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply