Get name of FILE without date

Hi Experts,
I am building a SSIS which will look for 2 files which will have <filename>Month year.xls.
I want to build the SSIS so it is fully automated I have everything working except I can't figure out how to either just look at the first 10 letters of the file name or ?? maybe there's a better way

Any help is much appreciated.
I am trying to do this with a Data Flow Task in case there is another way
Niall GallagherDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
Instead of just looking at the first part of the filename use variables to construct the filename including the repeatable portion.

If you can provide some examples I can help you work out the expression.

Here is an example:

http://www.sqlmatters.com/Articles/Including%20the%20Date%20in%20a%20Filename%20in%20SSIS%20using%20an%20Expression.aspx
Niall GallagherDeveloperAuthor Commented:
Thanks for your help and I will read the page you sent the link for.
but an example of the file name is "Contract_April.xls" and the other is worse (I think) "Agent - April 2015.xls"
Brian CroweDatabase AdministratorCommented:
Here are a couple of expressions that should work:

"Contract_" + (MONTH(getdate()) == 1 ? "January" : MONTH(getdate()) == 2 ? "February" : MONTH(getdate()) == 3 ? "March" : MONTH(getdate()) == 4 ? "April" : MONTH(getdate()) == 5 ? "May" : MONTH(getdate()) == 6 ? "June" : MONTH(getdate()) == 7 ? "July" : MONTH(getdate()) == 8 ? "August" : MONTH(getdate()) == 9 ? "September" : MONTH(getdate()) == 10 ? "October" : MONTH(getdate()) == 11 ? "November" : MONTH(getdate()) == 12? "December":"") + ".xls"

"Agent - " + (MONTH(getdate()) == 1 ? "January" : MONTH(getdate()) == 2 ? "February" : MONTH(getdate()) == 3 ? "March" : MONTH(getdate()) == 4 ? "April" : MONTH(getdate()) == 5 ? "May" : MONTH(getdate()) == 6 ? "June" : MONTH(getdate()) == 7 ? "July" : MONTH(getdate()) == 8 ? "August" : MONTH(getdate()) == 9 ? "September" : MONTH(getdate()) == 10 ? "October" : MONTH(getdate()) == 11 ? "November" : MONTH(getdate()) == 12? "December":"") + (DT_WSTR, 4)(DATEPART("yyyy", GETDATE()) + ".xls"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Niall GallagherDeveloperAuthor Commented:
Thank you for your help again. It looks easy when you know the answer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.