java2db

How to rename a file from a directory or folder in java



The method  renameTo(File file)  in java.io.File is used to rename a file or folder . If the directory or folder not having the specified file , the operation will fails.

 

rename a file from a directory or folder in java  The operation of rename a file might not be able to move a file from one file system to another.
rename a file from a directory or folder in java  It returns true if the file name renamed to specified name , false otherwise.

rename a file from a directory or folder in java Syntax:

<fileObject>.renameTo(<fileObjectDest>)

rename a file from a directory or folder in java Example rename a file:

Execution Result:

rename a file from a directory or folder in java Rename might not be succeed if a file with the destination abstract path name (same name) already exists .




Related Posts :
How to Connect to Oracle from Liferay portlet ( Java Liferay and Oracle integration )
How to Connect Liferay 7 to PostgreSQL ( Java Liferay portlet and PostgreSQL integration )
How to call C# .Net WCF web service in java SOAP client ( Visual Studio 2013 )
How to call PHP RESTful web service in java client
How to call java SOAP web service in php ( php web service client )
Solution to SSLHandshakeException (skip the certificate for Java and LDAP bind)
Java RESTful web service example in maven using JAX-RS
RESTful web service example in java using JAX-RS
   [will not be published]



^ <