locked e-mail attachment

Nov 22 2004 1:28 PM
Hello, I have a service that monitors (using the FileSystemWatcher) a directory for new file creations. When a file has been created, I need to generate an e-mail and send that newly created file as an attachment. The problem I'm running into is that as soon as the file is created the routine that sends the e-mail is fired...it usually takes a couple of seconds for the file to become unlocked after being written to. The result is an error message saying that the file cannot be accessed. Is there any way to make sure a file is free before adding it as an attachment? I'm sure there's a workaround for this, but I can't seem to come up with anything. Thanks in advance! Brian