Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Copying a File  RSS feed

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, what would be the best way to copy a text file to a new location?
I was thinking about:

And then somehow write the text from the old file in.
I'm not sure about FileWriters and OutputStreams, its a little confusing.

Any ideas?
 
rohit leeta
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess using java.nio will give you best performance:

http://www.exampledepot.com/egs/java.nio/File2File.html
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok
The program shown in the below link will help you to copy files from one location to another,but it is made using GUI ie a progressbar is shown while copying.I hope it wil be useful to you.
http://forum.java.sun.com/thread.jspa?threadID=617928&messageID=3455549
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!