SSIS Script Task Copy Files From One Folder into Multiple Folders

Ronald Van Der Westhuizen 41 Reputation points

Greetings Developers

I Hope Everyone is doing okay

i have a problem

allow me to walk you through it

i have a SQL table that has a result set of two columns named, 'SourceFilefolders' and destination'filefolders'

within those two those results sets has different folder locations and different files

basically what i am trying to do is following

  1. take the files within the source folder locations and place them into the same named folder locations placed on another server

i have tried every possible logic out there and it seems to be not working


i have attached even the ssis package to show what i am talking about


The Script take to make folder 1 is as follows

Public Sub Main()  
    Dim directory As Directory  
    Dim file As File  
    Dim filepath As String  
    filepath = Dts.Variables("ServerLocation").Value.ToString() + Dts.Variables("Folder1").Value.ToString()  
    Dts.TaskResult = ScriptResults.Success  
End Sub  

However to move the file from 'destination'filefolders' to 'SourceFilefolders' is what i am struggling with

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,067 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,486 questions
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ZoeHui-MSFT 34,581 Reputation points

    Hi @Ronald Van Der Westhuizen ,

    I'm not familiar with code writing, from SSIS side, to move files between servers, you may use File System Task.

    If it's a remote server you need a shared folder and correct permission to do it.


    If you want to do this with C#, check below link to see if it is helpful.




    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Olaf Helper 42,386 Reputation points

    Why with a .NET script task and not simply using a File System Task?

    0 comments No comments