Raul Villaronga posed a question on the SSIS forum today regarding the FileSystem task at http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=85827
The FileSystem task can move and rename files but Raul wanted to do both of those operations at the same time. As far as I can see (I stand to be corrected) this can't be done without 2 instances of the FileSystem task. There is a way around it though using our trusty script task and believe me, it couldn't be simpler.
First you need to set up 2 variables. One to hold the name and location of the file you want to move and another to hold the name and location that you want to move it to. Just like this:
Then drag a script task onto the control-flow surface and add these 2 variables to the ReadOnlyVariables property:
And finally...the code. I've added a TRY...CATCH block and the firing of some events to flesh it about a bit because, to be quite honest, it looks a bit forlorn otherwise!!!:
The bit that does all the work of course is the line starting File.Move(... Don't forget to import System.IO
OK, this is fairly noddy and I'm not pulling up any trees here am I it has to be said? But once again we've demonstrated just how easy to is to use SSIS in ways that you simply can't with competitor tools. In fact I'm beginning to think there isn't really a competitor to SSIS because its in a category all of its own. It really is so much more than an ETL tool.