Alex Rivera | Logout

How to test if a file is fully copied in .NET

Asked 2009-07-20T07:34:06.883
13

I am monitoring a folder for new files and need to process them. The problem is that occasionally file opening fails, because system has not finished copying it.

What is the correct way to test if the file is finished copying?

Clarification: I don't have write permissions to the folder/files and cannot control the copying process (it's the user).

Edit
Report

1 Answer

2

Not sure about "the correct way", but you could use the monitoring tool (FileSystemWatcher I guess) to fill an internal queue that you use for delayed processing. Or better yet: just use a queue to place files in that had the open fail, so you can retry them later.

answered 2009-07-20T07:38:53.723

Your Answer