
Function Main() |
Dim fso,myFile,filename(6),filestr,copystr,expstr,nostr |
nostr=year(now)&month(now)&day(now)&"_"&hour(now)&minute(now)&Second(now) |
expstr=".txt" |
filename(1)="file1" |
filename(2)="file1" |
'filename(3)="file3" |
' filename(4)="file4" |
For i = 1 To 2 |
filestr=DTSGlobalVariables("newdirstr").Value&filename(i)& expstr |
copystr=DTSGlobalVariables("newcopydirstr").Value&filename(i)& nostr& expstr |
'全局变量,newdirstr文本路径,newcopydirstr备份路径 |
' msgbox copystr |
Set fso = CreateObject("Scripting.FileSystemObject") |
'*********************copy file |
Set MyFile = fso.GetFile(filestr) |
MyFile.Copy (copystr) |
Next |
Main = DTSTaskExecResult_Success |
End Function |



