Board index » delphi » Copying a file that is opened (db file specifically)

Copying a file that is opened (db file specifically)

Hi,

I am trying to copy a db file (paradox) from one place to another while it
is being used to write certain records.

I run into an error becos the file is opened. I am trying to use
TfileStream to copy it.

Since I am only reading and not writing (a progressively increasing file),
is there any danger to corrupt the database file.
Also can someone teach me how to copy it even while it is in use.

Note: The copied version need not be the super-current updated version
since the original file is being written to continuously.

Thanks for any help.

Regards,
  Joe

 

Re:Copying a file that is opened (db file specifically)


Hello Joseph!

I think you can't read a file that is open for writing, because the data
could change while you copy it, the copy would be corrupted. It would
contain a bit of old and a bit of newer data.

It would be a better idea to create another database, and then batchmove
all the records of the database to the new one... This would be a more
suitable, system independant way to do it. (Use a TBatchMove control)

If anyone has better idea, let us know!

        Nicolas Binette
        sho...@microtec.net

Joseph <black...@singnet.com.sg> a crit dans l'article
<01bdcb65$33c732b0$f23615a5@master>...

Quote
> Hi,

> I am trying to copy a db file (paradox) from one place to another while
it
> is being used to write certain records.

> I run into an error becos the file is opened. I am trying to use
> TfileStream to copy it.

> Since I am only reading and not writing (a progressively increasing
file),
> is there any danger to corrupt the database file.
> Also can someone teach me how to copy it even while it is in use.

> Note: The copied version need not be the super-current updated version
> since the original file is being written to continuously.

> Thanks for any help.

> Regards,
>   Joe

Re:Copying a file that is opened (db file specifically)


Joe,

Sounds as if you might have to lock the table during the copy processing

Charles Johnson

Other Threads