In SSIS, I have an Execute Package Task that I have calling packages dynamically through the PackageName property in the Expressions property. Basically, for each file in my directory, call the package with the same name. My issue is that there may be instances where one or some of the files in the directory will not have a package associated with it, and that will always result in an error. How can I preemptively catch this error and deal with it so that the process does not stop altogether?
The solution I had in mind was using a Script Task in which I could iterate through all of the packages available in my project and compare it against the current file in the Foreach loop, and if no such package exists for the current file I would skip trying to process it. However, I could not easily find a way to enumerate through my project's package names. I attempted to do it via the method explained in this answer, but I could not seem to get it working for my purposes (I don't have this deployed on a server right now, which I think is what it is saying I should do, but I don't feel like I should need to just to accomplish this).
Is there a way to check if a package name for my project exists using a Script Task? Or is there any way in general to preemptively catch this error so I can allow the project to continue running?