foreach loop container to pick specific filename formats

  • Hi,

    Is there a way to specify wildcard characters in foreach file enumerator? For example, If I have several files in a folder

    sqlserver_test.xls

    sqlserver_02022010.xls

    sqlserver_1234.xls

    I only want to select files that have sqlserver_MMDDYYYY.xls format.

    thanks.

  • In files specify:

    sqlserver_????????.xls

    It could pickup sqlserver_AAAAAAAA because ? is not specific to numbers.. But this is about the only way I can think of..

    CEWII

  • Try the asterisk (*). I'm using *.txt and it works, perhaps it will work for sqlserver_*.xls as well.

    Chad

    EDIT: Whooops - reread your post and I see that * is not what you want. If Elliott's suggestion doesn't work, I think you'll have to grab all the files using somethink like an asterisk, then within the loop container have some logic based on the filename. Something like a script task that only succeeds if the filename matches the pattern you want. When it matches, it continues on, when it doesn't match, it goes to the next loop.

  • Elliott W (2/4/2010)


    In files specify:

    sqlserver_????????.xls

    It could pickup sqlserver_AAAAAAAA because ? is not specific to numbers.. But this is about the only way I can think of..

    CEWII

    Expanding on this idea, why not make it more robust by using

    sqlserver_????201?.xls?

    It'll work for a few years & then explode in 2020:-D

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • --deleted

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

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

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