Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Copy .mdb file and multiple files

 
kirtesh jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kirtesh jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for reply...
can i copy .mdb file also byte by byte or byte[] by byte[]???
thank you..
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a Lot sir, its working fine.....now...
thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic