This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes How to copy PDF/Ms Word file to another directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to copy PDF/Ms Word file to another directory" Watch "How to copy PDF/Ms Word file to another directory" New topic
Author

How to copy PDF/Ms Word file to another directory

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Hello,




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

Thanks & best regards
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8843
    
    7

Please search before posting. This question comes up all the time and there are many helpful posts like this one


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Thanks from the bottom of my heart

Best regards
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to copy PDF/Ms Word file to another directory
 
Similar Threads
Problem with FTPClient.retrieveFileStream
Cant delete all files in a directory in servlet in NetBeans
java.io.FileNotFoundException
Need help with moving file from one directory to other
Problem in moving file