Help (Check file exists/ Archive File/ Check if file empty)

  • Hello World,

    I'm new to SSIS and would like a little assistance getting started, if possible...

    Here is what I want to do:

    Check if file exist (C:\DTS Upgrade\File\xxx.txt) --->

    Archive file (C:\DTS Upgrade\Archive) --->

    Check if file has data (true or false)

    Thanks in advance for your help!!!

  • Those three tasks can be done within a Script Task. Just add that task to the Control Flow canvas and use methods available in the My.Computer.FileSystem namespace. You'll want to look at using package variables within the Script Task to make it more dynamic but this should give you an idea.

    Code to check for file, archive and inspect.

    If My.Computer.FileSystem.FileExists("c:\DTS\file\myfile.txt") Then

    My.Computer.FileSystem.MoveFile("c:\DTS\file\myfile.txt", "c:\DTS\archive\myfile.txt")

    Dim myFileInfo As System.IO.FileInfo

    myFileInfo = My.Computer.FileSystem.GetFileInfo("c:\DTS\archive\myfile.txt")

    If myFileInfo.Length > 0 Then

    MsgBox("Has data.")

    End If

    End If

  • Thank you Todd for your help...

    Do you know of any other good SSIS sites that may help me in my ssis development? If not, thanks for your time.

    Have a great day!!!

  • As well as the articles on this site take a look at Brian Knight's blog and videos on JumpstartTV.

    http://pragmaticworks.com/community/blogs/brianknight/default.aspx

    http://www.jumpstarttv.com : Look under Channels/Technology/Database/SQL Server/SQL Server 2005/SQL Server Integration Services.

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

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