Using Wildcards

  • When a wildcard is used in a User variable or in a script editor to find a file (such as: filename_xxxxxxxx.txt) where the xx's are equal to a date that changes on a regular basis why does the code return a failure result. If searched in windows explorer as "filename*.txt" returns a value.

    Are wildcards not accepted?

  • Are you using File.Exists to check the existance? If yes then you have to provide the path, wildcard wouldn't work.

    You can use the Foreach File enumerator to provide the File Pattern.

    Helpful links http://www.sqlis.com/55.aspx

    In the above article you can replace the data flow with a simple scrip that will check for the file. The code would be something like

    If File.Exists(Dts.Variables.Item("gvFileName").Value.ToString) Then

    MsgBox("File Found")

    Else

    MsgBox("File Not Found")

    End If

  • My problem isn't whether or not the file exists, it does and when I set a breakpoint I see that it finds the file, but I get a failure because for some reason SSIS doesn't recognize the Wildcard *.

    I have tried using the "*" in an expression and I am getting "illegal character".

    My question is: Why can't I use the Wildcard?

    Thanks

  • Where exactly are you tying to use the expression? Could you also eloborate on what are you trying to do?

  • Never knowing what the last part of my filename would be on any given day I would need to use a wildcard to return the file.

    This part of the file is a random timestamp that does not match any file attributes (unfortunately).

    I was finally able to use a ForEach Loop Editor, even though I only needed one file. The Collection enumerator expression was the only place that allowed me to enter the wildcard "*" and return the one file.

    There were 4 parts of the file:

    1. fixed name +

    2. current date +

    3. random timestamp +

    4. extension

    I was able to append the date to the name and then add the wildcard plus the extension in this section only.

    I needed to use a Flat File Connection Manager to return the information to a FileSystemTask to copy the file to the needed location to further process it.

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

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