• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Copy .mdb file and multiple files

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a Lot sir, its working fine.....now...
thank you.
reply
    Bookmark Topic Watch Topic
  • New Topic