SSIS script task

I need to copy file  and add today's date to the file copied.. I added this code to script task in SSIS and it wasnts me to do Dim oFso as ..help..can someone check the code below

Dim oFSO            
Dim sSourceFile
Dim sDestinationFile
 
Set oFSO = CreateObject("Scripting.FileSystemObject")
sSourceFile = "c:\Customer\Customerinfo.xls"
sDestinationFile = "c:\Customer\CustomerInfo& (cstr(month(date)) & "-" & cstr(day(date)) & "-" & cstr(year(date))) & ".xls"
 
oFSO.copyFile sSourceFile, sDestinationFile
 
Set oFso = Nothing
 
ohemaaAsked:
Who is Participating?
 
chapmandewCommented:
you can do this:

 System.IO.File.Copy(sSourcePath, newName, True)
0
 
chapmandewCommented:
You don't need to use FSO.  instead, import System.IO into your script, then use the following code to modify the files name:

System.IO.File.

it should pop up a list of methods available to use.
0
 
ohemaaAuthor Commented:
how do I do that pls? I am new to this stuff
0
 
chapmandewCommented:
open the script task, go to design script, and at the very top, add this:

Imports System.IO
0
 
ohemaaAuthor Commented:
can you explain.. if I do not use fso.  what do i use to copy the file from source to destination? like this
oFSO.copyFile sSourceFile, sDestinationFile
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.