Home Forums Data Warehousing Integration Services Recording File Name etc into a SQL Table using a loop for each directory required RE: Recording File Name etc into a SQL Table using a loop for each directory required

  • Debbie,

    In this particular case, I think you'd be better off learning a bit of scripting. Don't worry, it won't be much. A Script Source component which does a DIR on the directories would be your best bet here though instead of trying to fight your way through looping with tools that don't really want to talk to the filesystem.

    I don't have anything handy that uses the dir results as an array, but this little blurb will get you started.

    Dim result As String

    Dim SourceDirectory As String

    Dim FilenamePattern As String

    Dim Filename As String

    Filename = ""

    SourceDirectory = Dts.Variables("SourceDirectory").Value.ToString

    FilenamePattern = Dts.Variables("FilenamePattern").Value.ToString

    ' Package is expected to be fired off at 1 minute intervals via job scheduling.

    result = FileSystem.Dir(SourceDirectory & FilenamePattern)

    If you get stuck let me know. I'll have to dig through some archives and find some older code I used that did close to what you're asking for.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA