Process cannot access the file

  • Thread starter Thread starter Stuart Shay
  • Start date Start date
S

Stuart Shay

Hello All

I created a utility that uses the File System Watcher and then once the File
is copied to the Watch Directory my utility parses the file then moves the
files to a set directory.

The Problem is that I am using a Anti-Virus Software on my server since I am
coping allot of files to the watch directory the Anti Virus Scans the
directory and locks my files from being Moved.

So My Question Is ?
Is there a way to determine if a Process is on a File wait till that process
is complete and then perform my coping method on the given file.
 
* "Stuart Shay said:
I created a utility that uses the File System Watcher and then once the File
is copied to the Watch Directory my utility parses the file then moves the
files to a set directory.

The Problem is that I am using a Anti-Virus Software on my server since I am
coping allot of files to the watch directory the Anti Virus Scans the
directory and locks my files from being Moved.

So My Question Is ?
Is there a way to determine if a Process is on a File wait till that process
is complete and then perform my coping method on the given file.

AFAIS no -- you will have to try to move the file until it can be moved.
 
Hi Herfried,
AFAIS no -- you will have to try to move the file until it can be moved.

This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files which
where locked and do them at the end?

And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?

Cor
 
* "Cor Ligthert said:
This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files which
where locked and do them at the end?

Yep -- that's the approach I would follow.
And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?

AFAIS = "As Far As I See".
 
Thanks for the Response, I decided that if I add a 1sec delay before I move
the file the Anti Virus Scan will be completed before it is time to process
the file being scaned.

Thread.Sleep(1000)

If anyone can give me a better solution to determine if the file is being
used by another process before I move it would be appreciated.

Thanks
Stuart
 
Back
Top