How to check if file exist under a folder?

  • I am rewrite a DTS importing package to SSIS package, at first process, I need to check if the file exist at FTP site. Anyone can help me

  • this is the script i wrote so far:

     

    Imports

    System

    Imports

    System.Data

    Imports

    System.Math

    Imports

    Microsoft.SqlServer.Dts.Runtime

    Public

    Class ScriptMain

    Public Sub Main()

    If Exists(Dts.Variables("txtFilePathFileName").Value) = "false" Then

    Dts.Variables(

    "FileExists").Value = "0"

    Else : Dts.Variables("FileExists").Value = "1"

    End If

    Dts.TaskResult = Dts.Results.Success

    End Sub

    End

    Class

  • Here is how I did it:

    Function Main()

    Dim oFSO, sImportFile

    sImportFile = "\\severname\share\filename.txt"

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    If oFSO.FileExists(sImportFile) Then

    Main = DTSTaskExecResult_Success

    Else

    Main = DTSTaskExecResult_Failure

    End If

    Set oFSO = Nothing

    End Function

    Then do a precedence on success.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply