aspose file tools*
The moose likes Beginning Java and the fly likes Copy .mdb file and multiple files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Copy .mdb file and multiple files" Watch "Copy .mdb file and multiple files" New topic
Author

Copy .mdb file and multiple files

kirtesh jain
Ranch Hand

Joined: Nov 15, 2008
Posts: 44
hi..
i am new to java...
in my application , at one place for taking back up i have to copy .mdb file from one place to another ...
please can anyone help me, how can i do that ....and also if possible tell me for multiple files of multiple type...how we can copy..
thank you
Aum Tao
Ranch Hand

Joined: Feb 14, 2006
Posts: 210
You might want to learn more about the Process class in the javadoc. It allows you to get the runtime object associated with the current JVM using the getRuntime() method that you can use to perform operations like copy and move files.


SCJP 1.4 85%
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

It may be overkill to use a new process for copying and moving files.

Moving is quite easy: renameTo will do just that, even across different partitions.

Copying can be done either by byte per byte / byte[] per byte[] reading and writing from a FileInputStream / into a FileOutputStream, or using FileChannels.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
kirtesh jain
Ranch Hand

Joined: Nov 15, 2008
Posts: 44
thanks for reply...
can i copy .mdb file also byte by byte or byte[] by byte[]???
thank you..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

You can copy any file byte per byte or byte[] per byte[], unless the operating system blocks access to the file.
For .mdb files (I assume we're talking about MS Access) you can check for the presence of a .ldb file with the same name in the same folter. If it's there, there is a program that has the .mdb file open.
kirtesh jain
Ranch Hand

Joined: Nov 15, 2008
Posts: 44
Thanks a Lot sir, its working fine.....now...
thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Copy .mdb file and multiple files