count no. of files

  • I need to count no. of files in a directory and if no. of files more than 3 then execute dts package , if not then don't

    need your suggestion and solution..

    is this can add in sql agent job?

  • To count the number of files in a dir.You can use a Script Task,with the code below

    Dim numberOfFiles As Integer

    Dim path As String = "c:\Files\" **Your PATH

    numberofFiles = System.IO.Directory.GetFiles(path).Length

    Save the numberofFiles to a variable.If number of files are =3 then drag script task to execute package task[if you have some package ready to perform the manipulation or data load ready] else join it to any of the other transformation.

    And Yes,save the package and create a sql job with type of SSIS.This would enable you to schedule your package.

    Hope this helps out

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

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