Importing in ssis when a file is of a certain size

  • Hi All,

    I am creating packages that import xml files.

    however I want to import files that are more than 213kb in size. I have a fore each container which picks up the files.

    Is there any way in ssis to check for the file size before importing?

    Any help will be highly appreciated

    Thanks

    Yarhad

  • Finding out the file size isn't difficult, but the real question is why the size matters. What do you intend to do differently if the size is 512KB instead of 213KB, and why? If you have a For Each loop in place, will you need to check each file before processing it?

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Thanks steve for your reply.

    the situation is this...

    I have xml files that I import everyday and when the file size is say 1kb,

    the file structure doesn't match the destination table because the file is empty of data.

    but when it is say 245 or even 16kb in size then it has data and hence the file structure matches the destination table.

    I am just looking for a way to ignore the files that have a size of 1kb. something like that

    Thanks

    Yarhad

  • Hi Steve

    Sorry, and yes if I have a for each loop container, I will need to check each file before I process it

    thanks Yarhad

  • Within a container I use a script task to verify the file

    eg.

    Dim FileInf As FileInfo

    FileInf = New FileInfo(Dts.Variables("User::FullFileName").Value.ToString())

    Dts.Variables("User::FileSize").Value = CInt(FileInf.Length)

    and then depending on the filesize set a status flag, which I then use a precedence constraint outside of the script to select the component output flow as per diagram.

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

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