DTSFTPTask Object
The DTSFTPTask object transfers one or more files from a specified Internet FTP site or network directory to a destination directory.
The New method of the Tasks collection of the Package object returns a reference to a Task object. The CustomTask property of the Task object returns a reference to the appropriate custom task object.
Example
The following Microsoft® Visual Basic® code uses the DTSFTPTask object to copy the files File3.dat and NWProdWiz.xls from the directory I:\DTS\TestData to D:\DTS_UE\Dest.
Public Sub Main()
'Copy files from I:\DTS\TestData to D:\DTS_UE\Dest.
Dim oPackage As DTS.Package
Dim oStep As DTS.Step
Dim oTask As DTS.Task
Dim oCustTask As DTSCustTasks.DTSFTPTask
Set oPackage = New DTS.Package
oPackage.FailOnError = True
'Create step and task, link step to task.
Set oStep = oPackage.Steps.New
oStep.Name = "FTPSrcDirStep"
Set oTask = oPackage.Tasks.New("DTSFTPTask")
Set oCustTask = oTask.CustomTask
oCustTask.Name = "FTPSrcDirTask"
oStep.TaskName = oCustTask.Name
oPackage.Steps.Add oStep
Set oStep = Nothing
'Specify files, source and destination directories.
oCustTask.SourceLocation = DTSFTPSourceLocation_Directory
oCustTask.SourceSite = "I:\DTS\TestData"
oCustTask.SourceFilename = _
"'File3.dat';'';'123';'NWProdWiz.XLS';'';'458240';"
oCustTask.DestSite = "D:\DTS_UE\Dest"
'Link task to package, run package.
oPackage.Tasks.Add oTask
Set oCustTask = Nothing
Set oTask = Nothing
oPackage.Execute
Set oPackage = Nothing
End Sub