How to check is File or Directory using Java

 Posted On  | Yashwant Chavan

This tutorial will help you to identify that file is a file or directory? java.io.File class provides two methods .isFile() and .isDirectory () with the help these two methods you find out if the file is file or a directory.

Get filename without extension using Java

 Posted On  | Yashwant Chavan

This file utility method helps you to remove the file extension from file name. Here I am using simple regular expression which will remove the last dot followed by one or more characters of file extension.

Rename a File in Java

 Posted On  | Yashwant Chavan

This Java File API boolean java.io.File.renameTo(File newFile) method is used to rename the file. It is always recommended to check the return value. It helps you to make sure that the rename operation was successful or not. API It returns true when rename is successful, and false if unsuccessful.

Display Recursively Files and Folder List in Java

 Posted On  | Yashwant Chavan

Recently I am working on the some java file operation task,Requirement is so simple , program should reads all the files and folders. There are thousands of files generated on hard drive on daily basis so my program need to delete all those files whose file-size is more than 10MB.This clean up executed on daily basis and delete the respected files.

Append Content to File in Java

 Posted On  | Yashwant Chavan

In this tutorial we will learn how append content to file in Java. It will constructs a FileWriter object on given a File object. If the second argument is true then bytes will be written to the end of the file rather than the beginning.

Get Current File Path In Java

 Posted On  | Yashwant Chavan

In this tutorial we will learn how to get current file path In Java.Refer below code to display the current directory path. There are two way to get the current directory path either get it through new File(".").getCanonicalPath() method. Here dot represents the current directory. And another way is using user.dir property. System.getProperty("user.dir").


© technicalkeeda.com 2017

 |  Find us on Google+ |  Rss Feed

Loaded in 0.0432 seconds.