Home All Groups Group Topic Archive Search About
Author
30 Jan 2006 2:49 PM
Denis Correard
I'm writing an application that would move a file from 1 place to another
and print it, but I'm having errors if the file is in use by another process
when I'm trying to move it. Is there a way to check that before I try to
move the file?

I'm using .Net 1.1, VB and VS 2003

Any ideas are welcome

Author
30 Jan 2006 3:03 PM
Andrew Morton
Denis Correard wrote:
> I'm writing an application that would move a file from 1 place to
> another and print it, but I'm having errors if the file is in use by
> another process when I'm trying to move it. Is there a way to check
> that before I try to move the file?

Try to move the file. If you catch an error then perhaps wait a while and
give it another go. Finally, curse it for not offering a function to tell
you what the current access state of the file is.

Would it be sufficient to /copy/ the file to another location to print it?
You have more chance of that succeeding.

Andrew
Author
30 Jan 2006 4:16 PM
Denis Correard
Yes and no because same times to file stil been created on disk so copying
it would not be good.

Show quoteHide quote
"Andrew Morton" <a**@in-press.co.uk.invalid> wrote in message
news:OWjEl5aJGHA.1180@TK2MSFTNGP09.phx.gbl...
> Denis Correard wrote:
>> I'm writing an application that would move a file from 1 place to
>> another and print it, but I'm having errors if the file is in use by
>> another process when I'm trying to move it. Is there a way to check
>> that before I try to move the file?
>
> Try to move the file. If you catch an error then perhaps wait a while and
> give it another go. Finally, curse it for not offering a function to tell
> you what the current access state of the file is.
>
> Would it be sufficient to /copy/ the file to another location to print it?
> You have more chance of that succeeding.
>
> Andrew
>