rsmuckles
asked on
best way to rename files in SSIS
Greetings . . . I'm helping to convert a number of DTS packages to DTSX. There are a number of ActiveX scripts which no longer function, and I need to find alternative means of doing those tasks. The most common one is to rename a flat file using today's date, for instance renaming:
file_yyyymmdd.txt
to
file_20090508.txt
I've attached the old script below. It's very simple, but SSIS doesn't like it. How would I do this in a way that SSIS likes?
file_yyyymmdd.txt
to
file_20090508.txt
I've attached the old script below. It's very simple, but SSIS doesn't like it. How would I do this in a way that SSIS likes?
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dim fso
dim d
dim m
dim y
d = day(date)
m = month(date)
y = year(date)
if len(d) = 1 then d = "0" & d
if len(m) = 1 then m = "0" & m
set fso = createobject("Scripting.FileSystemObject")
fso.copyfile "C:\test\Refresh_yyyymmdd.txt", "C:\test\GW_Refresh_" & m & d & y & ".txt"
fso.DeleteFile "C:\test\Refresh_yyyymmdd.txt"
Main = DTSTaskExecResult_Success
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I understand that ultimately any complex scripts in ActiveX will need to be written again in .NET. Is there, however, another way for me to do a text replace in a filename with today's date? I am mostly a hardware & database guy and am just helping with this initiative, so learning how to be a programmer for this one task is not a realistic option.
ASKER
thanks
So you have to declare the type of your variables as a starter.