lenght is reported as zero in filesystemwatcher 
Author Message
 lenght is reported as zero in filesystemwatcher

when using this code snippet, the file lenght is returned as zero. it seems
that the event is triggered as soon as the file starts copying to the
server, therefore not capturing the full size of the file. is this a
filesystemwatcher limitation? or is there another way to do this?

'Event that will be raised when a new file is created

Shared Sub OnFileEvent(ByVal source As Object, ByVal e As

Dim FileName As String = Path.GetFileNameWithoutExtension(e.FullPath)

Dim TheDate1, TheDate2, MailMessage, MailSubject, MailTo As String

Dim FileOK As Boolean = True

Dim i As Integer = 0

Dim FileNFO As FileInfo = New FileInfo(e.FullPath)

Dim TheBoard As String = ""

Dim TheDate As String

Dim vFileSize As String

Dim vFileName As String

Dim vFilePath As String

Dim vFileCreateDate As String

Dim FileRegExOne, FileRegexTwo As Regex

TheDate = Now.ToString("yymmdd")

FileRegExOne = New Regex("^([0-9]{6}|[0-9]{8})(p|p[0-9])?$",

FileRegexTwo = New Regex("adfadfadf")

' get zip file attributes

vFileSize = FileNFO.Length()

Sun, 30 Jan 2005 03:36:05 GMT  
 lenght is reported as zero in filesystemwatcher
I tested the code on a Windows 2000 machine,  but it works fine. The file
size is correctly retrieved. I am calling the Sub OnFileEvent in the
FileSystemWatcher1_Created event handler.

David Yuan
This posting is provided "AS IS" with no warranties, and confers no rights.
"Got .Net?  http://www.gotdotnet.com".  

Sun, 30 Jan 2005 15:50:46 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Help: Cannot contain zero-lenght string error

2. SQL Altered field can't be zero-lenght

3. Dividing Zero by Zero

4. Division By Zero error when there is no zero

5. How to set all Null values to Zero in a report

6. Leading Zeros in data reports?

7. Divide by zero error upon formating a report!

8. Leading Zeros in data reports?

9. Crystal stops on reports with zero results

10. How to print leading zeroes in Crystal Reports

11. Crystal Report Graph Problem (No Zero and No Lines attached in Line Graph)

12. Help - Cross Tab report displaying zero-length strings


Powered by phpBB® Forum Software