This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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
Author

how to copy a .doc file through java

Ramaswamy Narayanan
Greenhorn

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
by
narayanan
Rawat (Zeon)
Greenhorn

Joined: Feb 12, 2005
Posts: 5
Hi

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 = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}

Thank,
Zeon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to copy a .doc file through java