Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to copy PDF/Ms Word file to another directory

 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9214
9
Linux Mac OS X Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please search before posting. This question comes up all the time and there are many helpful posts like this one
 
Harsha Smith
Ranch Hand
Posts: 287
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks from the bottom of my heart

Best regards
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic