SSIS Move FIle Task and Rename

I have a file task that moves a file (variable) fro  Inbound folder to a processed folder

I would like to also rename that file in the process to the same filename.csv to filename_yyyyMMddmmss.csv
Larry Bristersr. DeveloperAsked:
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.

Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
Hello!

This can be done by using a ForEach Iterator to iterate through the files and the "File System Task" with a "Rename File" configuration to perform the rename and/or file move once the processing is complete. You can look at the details in my post here: https://nakulvachhrajani.com/2016/11/28/0395-sql-server-ssis-adding-date-and-time-to-a-file-name-after-processing/

In summary, you will need a variable to build the new file name with a string similar to the one below (which is for yyyyMMdd, but you can extend it for mmss as well):
SUBSTRING(@[User::FileName], 1, FINDSTRING(@[User::FileName],".",1) -1 ) + (DT_WSTR,4)YEAR(GETDATE()) + (DT_WSTR,2)MONTH(GETDATE()) + (DT_WSTR,2)DAY(GETDATE())

Open in new window

0

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
Larry Bristersr. DeveloperAuthor Commented:
Perfect. Thanks
0
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
Glad that I could be of help. Thanks the grade! :)
0
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
SSIS

From novice to tech pro — start learning today.