K
kkizer
I have a problem with this simple code below. Moving the files works
perfectly, but once in a blue moon the file that it is trying to move
dissapears before it can move it. and when this happens the
"System.IO.Move" goes in to a loop and keeps creating the file on the
destination folder with a 0byte size and keeps entering the error in
the log i have until someone stop the service. so what i cant figure
out is since it catches the Exception why does it keep creating the
file and keep trying to move that file that does not exist. Could i put
some code in the Exception that would automatically stop the service? i
need help !!!!!!!
Try
filePath = strPath & theFile.ToString & "_" & e.Name
System.IO.File.Move(e.FullPath, filePath)
Catch ex As Exception
sw = fso.AppendText("D:\WORKSTATIONSCANS\errlog.txt")
sw.WriteLine(Now() & " - MOVE - " & e.FullPath &
filePath & ex.ToString)
sw.Flush()
sw.Close()
End Try
error log shows:
7/25/2006 11:51:09 AM - MOVE -
d:\workstationscans\3845423.tif\\NASHVILLE-BROKERAGE\IMAGES$\28e367e0-d50e-468e-87ec-7a50f8c4ad1e_3845423.tifSystem.IO.FileNotFoundException:
Could not find file "d:\workstationscans\3845423.tif".
File name: "d:\workstationscans\3845423.tif"
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.Move(String sourceFileName, String destFileName)
at WorkioScanWatcher.Service1.FileSystemWatcher1_Created(Object
sender, FileSystemEventArgs e)
7/25/2006 11:51:17 AM - MOVE -
d:\workstationscans\3845423.tif\\NASHVILLE-BROKERAGE\IMAGES$\a9a947af-7993-4707-874e-e187e6e139c8_3845423.tifSystem.IO.FileNotFoundException:
Could not find file "d:\workstationscans\3845423.tif".
File name: "d:\workstationscans\3845423.tif"
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.Move(String sourceFileName, String destFileName)
at WorkioScanWatcher.Service1.FileSystemWatcher1_Created(Object
sender, FileSystemEventArgs e)
7/25/2006 12:12:14 PM - MOVE -
d:\workstationscans\3845423.tif\\NASHVILLE-BROKERAGE\IMAGES$\a0597cfa-9e42-43cc-ac5f-3de8e2544983_3845423.tifSystem.IO.FileNotFoundException:
Could not find file "d:\workstationscans\3845423.tif".
File name: "d:\workstationscans\3845423.tif"
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.Move(String sourceFileName, String destFileName)
perfectly, but once in a blue moon the file that it is trying to move
dissapears before it can move it. and when this happens the
"System.IO.Move" goes in to a loop and keeps creating the file on the
destination folder with a 0byte size and keeps entering the error in
the log i have until someone stop the service. so what i cant figure
out is since it catches the Exception why does it keep creating the
file and keep trying to move that file that does not exist. Could i put
some code in the Exception that would automatically stop the service? i
need help !!!!!!!
Try
filePath = strPath & theFile.ToString & "_" & e.Name
System.IO.File.Move(e.FullPath, filePath)
Catch ex As Exception
sw = fso.AppendText("D:\WORKSTATIONSCANS\errlog.txt")
sw.WriteLine(Now() & " - MOVE - " & e.FullPath &
filePath & ex.ToString)
sw.Flush()
sw.Close()
End Try
error log shows:
7/25/2006 11:51:09 AM - MOVE -
d:\workstationscans\3845423.tif\\NASHVILLE-BROKERAGE\IMAGES$\28e367e0-d50e-468e-87ec-7a50f8c4ad1e_3845423.tifSystem.IO.FileNotFoundException:
Could not find file "d:\workstationscans\3845423.tif".
File name: "d:\workstationscans\3845423.tif"
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.Move(String sourceFileName, String destFileName)
at WorkioScanWatcher.Service1.FileSystemWatcher1_Created(Object
sender, FileSystemEventArgs e)
7/25/2006 11:51:17 AM - MOVE -
d:\workstationscans\3845423.tif\\NASHVILLE-BROKERAGE\IMAGES$\a9a947af-7993-4707-874e-e187e6e139c8_3845423.tifSystem.IO.FileNotFoundException:
Could not find file "d:\workstationscans\3845423.tif".
File name: "d:\workstationscans\3845423.tif"
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.Move(String sourceFileName, String destFileName)
at WorkioScanWatcher.Service1.FileSystemWatcher1_Created(Object
sender, FileSystemEventArgs e)
7/25/2006 12:12:14 PM - MOVE -
d:\workstationscans\3845423.tif\\NASHVILLE-BROKERAGE\IMAGES$\a0597cfa-9e42-43cc-ac5f-3de8e2544983_3845423.tifSystem.IO.FileNotFoundException:
Could not find file "d:\workstationscans\3845423.tif".
File name: "d:\workstationscans\3845423.tif"
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.Move(String sourceFileName, String destFileName)