Solved

SSIS script task

Posted on 2008-10-08
5
332 Views
Last Modified: 2013-11-10
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
Comment
Question by:ohemaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 22671973
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
 

Author Comment

by:ohemaa
ID: 22672327
how do I do that pls? I am new to this stuff
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22672424
open the script task, go to design script, and at the very top, add this:

Imports System.IO
0
 

Author Comment

by:ohemaa
ID: 22673153
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
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22673173
you can do this:

 System.IO.File.Copy(sSourcePath, newName, True)
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question