none
Copying multiple files to a Winscp directory via Script

    Question

  • Hi,

       I have a question regarding copying multiple files from one directory to remote directory in SSIS,I'm using WINSCp,below is my script file

    option batch on
    option confirm off
    open username:password@ipaddress -timeout=1000 -hostkey="ssh-rsa 39439:xx:xx:xx:xx:xx"
    option transfer binary

    put c:\temp\*.xlsx
    close
    exit

              It copies the first file successfully i have couple more to be copied .Is this the correct way to copy multiple files?Please guide me.

    Thanks in Advance


    Anita

    Wednesday, November 13, 2013 4:38 PM

Answers

  • I used -nopreservetime and -nopermissions in put command ,that took take care of my script

    option batch on
    option confirm off
    open username:password@ipaddress -timeout=1000 -hostkey="ssh-rsa 39439:xx:xx:xx:xx:xx"
    option transfer binary
    put -nopreservetime  -nopermissions c:\temp\*.xlsx
    close
    exit


    Anita

    • Marked as answer by Anita12 Friday, November 15, 2013 5:25 PM
    Friday, November 15, 2013 5:25 PM

All replies

  • It is not SSIS related since you use a batch file.

    the file mask looks correct, but I am curious if you get an error.


    Arthur My Blog

    Wednesday, November 13, 2013 4:48 PM
  • I'm not getting an error,bascially its not copying rest of the files .

    Anita

    Thursday, November 14, 2013 3:31 PM
  • This would be a question for WINSCP, not SQL Server.

    Please see:

    http://winscp.net/eng/docs/scriptcommand_put

    Thursday, November 14, 2013 3:43 PM
  • I'm not getting an error,bascially its not copying rest of the files .

    Anita

    Can you copy them using say FileZilla?

    Typically if one file works then another does not I suggest to try that other file.

    One client I know of has an odd rule that prevents multiple file uploads on one session - this is done for security reasons. Perhaps you have the same case, I forgot the exact commercial software name that does that.


    Arthur My Blog

    Thursday, November 14, 2013 4:35 PM
  • If you want to use SSIS, you need to use ForEachLoop for loopig through required files. use the File Enumerator inside ForEachLoop for this and point it to folder where you have the files. Next use a script task inside to pass the dynamic file name and create script file inside it. You can find a sample package illustrating dynamic creation of script for WinSCP in below link.

    http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html

    Next have the execute process task to call WinSCP.com with created script file passed as an argument.

    In short, package will look like that in above link with difference that it wont have data flow task in the beginning but will just have other two tasks inside a ForEachLoop

    Please Mark This As Answer if it helped you to solve the problem.

    Thursday, November 14, 2013 6:53 PM
  • I used -nopreservetime and -nopermissions in put command ,that took take care of my script

    option batch on
    option confirm off
    open username:password@ipaddress -timeout=1000 -hostkey="ssh-rsa 39439:xx:xx:xx:xx:xx"
    option transfer binary
    put -nopreservetime  -nopermissions c:\temp\*.xlsx
    close
    exit


    Anita

    • Marked as answer by Anita12 Friday, November 15, 2013 5:25 PM
    Friday, November 15, 2013 5:25 PM