This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to copy files at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to copy files at runtime" Watch "how to copy files at runtime" New topic
Author

how to copy files at runtime

mythily prakash
Ranch Hand

Joined: Jan 27, 2006
Posts: 31
hi,
i've to copy all the files in one directory to some other dir.
I can copy the files if and only if i know the filename and its extension.I may know the dir exactly but not the files inside and these files are with different extension.This program will have to work in java1.3,1.4 & 1.5 also.Pls help me to get it rite way.


Best Regards,<br />Mythily.S<br />9886530336
Ben Cramphorn
Greenhorn

Joined: May 13, 2004
Posts: 17
Hello.

Try looking up file.list() on the API.
mythily prakash
Ranch Hand

Joined: Jan 27, 2006
Posts: 31
Thanks Ben Cramphorn.

I can do it with the following code:
Ben Cramphorn
Greenhorn

Joined: May 13, 2004
Posts: 17
No worries.
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
If you are targetting 1.4 or higher, you may want to consider using java.nio and obtain performance benefits (I cannot prove this - hearsay).


Tony Morris
Java Q&A (FAQ, Trivia)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to copy files at runtime
 
Similar Threads
problem accessing ejb via jsp
Copy Dir/subDir/files API
copying files
deployment directory
File race condition