Link to home
Start Free TrialLog in
Avatar of elucero
elucero

asked on

check filesize in ssis 2005

Hi, I'm pretty new to ssis script task, I would like to know how I can check the file size's in the following code and if it's 0 then fail it.  I'm using ssis 2005.

Public Sub Main()
            

        Dim pErrorMessage As String
        Dim i As Integer
        Dim FileName As String
     

       
           For i = 0 To Dts.Variables.Count - 1
           
            If Dts.Variables(i).Name <> "ErrorMessage" Then
                FileName = CType(Dts.Variables(i).Value, String)
                 If (My.Computer.FileSystem.FileExists(FileName) = False) Then
                    pErrorMessage = pErrorMessage + " " + FileName + " does not exist, "
                End If
            End If
        Next
        If pErrorMessage = "" Then pErrorMessage = "NOERROR"
        'MsgBox(pErrorMessage)
        Dts.Variables("ErrorMessage").Value = pErrorMessage
       
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of QPR
QPR
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial