I process around 10 files each day and the naming convention of the files are MMDDYY_FileName.
我每天处理大约10个文件,文件的命名约定是MMDDYY_FileName。
I currently have a SSIS package to load these files but I don’t have anything in place that tells me if any of the files missing.
我目前有一个SSIS包来加载这些文件,但我没有任何东西告诉我是否缺少任何文件。
I want to be able to send an email if any of the files are missing with the missing file names included in the email.
我希望能够发送电子邮件,如果缺少任何文件,电子邮件中包含丢失的文件名。
I know how to write a simple vb.net code for checking a single file but not sure how I can check for multiple files and store the missing file names.
我知道如何编写一个简单的vb.net代码来检查单个文件,但不知道如何检查多个文件并存储丢失的文件名。
Can someone please provide me an example of checking two or more missing files?
有人可以给我一个检查两个或更多丢失文件的例子吗?
Below is the code I have so far for checking a single file:
下面是我到目前为止检查单个文件的代码:
If (File.Exists(CStr(Dts.Variables("filePath").Value))) Then
Dts.TaskResult = Dts.Results.Success
Else
Dts.TaskResult = Dts.Results.Failure
1 个解决方案
#1
Dim lst As New List(Of String) From {"path1", "path2", "..."}
Dim result as Boolean = True
For Each item As String In lst
If not File.Exists(item) Then
result = False
Exit For
End If
Next
Dts.TaskResult = Result
#1
Dim lst As New List(Of String) From {"path1", "path2", "..."}
Dim result as Boolean = True
For Each item As String In lst
If not File.Exists(item) Then
result = False
Exit For
End If
Next
Dts.TaskResult = Result