Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • Last Modified:

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
 
0
ohemaa
Asked:
ohemaa
  • 3
  • 2
1 Solution
 
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
 
chapmandewCommented:
you can do this:

 System.IO.File.Copy(sSourcePath, newName, True)
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.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now