my dog learned polymorphism
The moose likes Other JSE/JEE APIs and the fly likes how to copy a .doc file through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to copy a .doc file through java" Watch "how to copy a .doc file through java" New topic

how to copy a .doc file through java

Ramaswamy Narayanan

Joined: Jan 19, 2005
Posts: 24
hello friends

i need to copy a word file(.doc file) from one folder to another.
is it possible? if yes, how?
please help me immediately.
thank you
Rawat (Zeon)

Joined: Feb 12, 2005
Posts: 5

If it's just copying a file from one folder to another you can use copy method given below.

// Copies src file to dst file.
// If the dst file does not exist, it is created
void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);

// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = > 0) {
out.write(buf, 0, len);

I agree. Here's the link:
subject: how to copy a .doc file through java
It's not a secret anymore!