This code moves the file whereas I am looking for copying the file.
I mean the original file will remain on its place but its copy will be made to other directory. Please note file may be pdf or word any format
Something worth checking out is org.apache.commons.io.FileUtils, and Apache Commons I/O in general. There are lot of useful utility methods there, including ones for copying files on a file system. I like Harsha's example using NIO though.
WARNING! Do not activate jet boots indoors or you will see a tiny ad: