need help with regex excluding .txt extension in for each loop

  • I have 2 files named charge_t, the only difference is that one has a .txt extension and the other has no extension. I want to use a for each loop but want to exclude the file with the .txt extension. How can I do this?

  • I have done this using a script component as well as a stored proc that utilizes xp_cmdshell. Both can easily be used in SSIS to populate your object prior to use by the foreach loop.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I found a workaround, I first moved all of the files with the .txt extension using the regex "FileName*.txt" then used the foreach loop container to grab the ones I needed.

  • You indicate no extension by ending your Regex with a period, e.g., "Filename*." The trailing period is optional if there is no extension, so it is usually omitted, but you want to include it in this case.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • Ok, thanks. Good to know for future reference.

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

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