check filesize in ssis 2005

Posted on 2012-09-20
Medium Priority
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

QPR earned 1500 total points
ID: 38420897

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

862 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