check filesize in ssis 2005

Posted on 2012-09-20
Last Modified: 2012-11-27
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
        If pErrorMessage = "" Then pErrorMessage = "NOERROR"
        Dts.Variables("ErrorMessage").Value = pErrorMessage
    End Sub
Question by:elucero
    1 Comment
    LVL 29

    Accepted Solution


    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    Suggested Solutions

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now