AnthonyN917
asked on
How can I rename a dynamic source file in SSIS
I have a CSV file XXXX_YYYYMMDD.CSV that I grab off of an FTP Site. I am looking to rename this file after I place in my directory. I am looking to rename the file to XXXX.CSV. I try to rename it using the file system task however, the file will change everyday so I do not have the proper name once it is in my directory to change it. Can anyone direct me in being able to change this dynamic file name?
ASKER
Hello,
I appreciate the response, but I am just not sure how to write the script that will include the name in the SourceFileName variable. I never really worked with scripts in SSIS before.
I appreciate the response, but I am just not sure how to write the script that will include the name in the SourceFileName variable. I never really worked with scripts in SSIS before.
The code in a Script Task is VB.Net or C#. If you can rite a script in VB.Net or C# to handle the name manipulation, then all you need to do is create the variable and reference it in the code using Dts.Variable("variablename ").Value = {your code to create the filename}
Do some research on MSDN to learn about the Script Task object.
Do some research on MSDN to learn about the Script Task object.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The VS 2008 looping containers did all the work for me.
Did that involve a variable of any sort? Did you, perhaps, follow my advise to go to the MSDN site to do some research?
Did that involve a variable of any sort? Did you, perhaps, follow my advise to go to the MSDN site to do some research?
ASKER
I was able to figure it out myself.
Note: If you're TargetFileName variable indicates a folder path that doesn't exist, you will need to make sure that you create the path portion of that filename prior to attempting to write to it. That, too, can be done in a Script Task (e.g. the same place that the value is set).