Wednesday, March 7, 2012

File System Task: Move/Rename

I can use the File System Task to Move a file from one directory to another and to rename a file, but is there a way to do this in one step, i.e., move file named 'c:\foo.txt' to 'c:\backup\foo_bkp.txt'?You should be able to accomplish this in an expr.|||

OK, maybe I'm being dense ... but how? I have both Source and Destination set to variables. The "Move File" facility only accepts a directory as the Destination because when I coded it with a new file name, I got an error due to the destination file name being ["DestVariable"]\["SourceFileName"] so it looked like:

c:\backup\foo_bkp.txt\foo.txt

|||Raul,
You can use a script task to do this. See here: http://blogs.conchango.com/jamiethomson/archive/2005/09/14/2149.aspx

-Jamie

No comments:

Post a Comment