Dear friends
currently i'm using FTP to transfer some cleartxt data from a client to a server because its not business data, but now I would include confidenial data so we have to swing over to SFTP server. how can I convert my script?
 Code:
 $local="c:\windows\test"
 $Patch="c:\windows\test"
 $dirs="cd"
 $site2="62.xx.xx.xx"
 $site2_user="test\Bello"
 $site2_pw="Belloxxxxx"
 
:ftp_files
 Del "c:\windows\test\ftp.cmd"
 If (Open(1,"c:\windows\test\ftp.cmd",5) = 0)

  $nul=WriteLine(1,"open $site2"+Chr(13)+Chr(10))
  $nul=WriteLine(1,"$site2_user"+Chr(13)+Chr(10))
  $nul=WriteLine(1,"$site2_pw"+Chr(13)+Chr(10))
  $nul=WriteLine(1," binary"+Chr(13)+Chr(10))
  $nul=WriteLine(1," status"+Chr(13)+Chr(10))
  $nul=WriteLine(1," mkdir"+ " Easy_reports\" + $NAME + Chr(13)+Chr(10))
  $nul=WriteLine(1," cd"+Chr(13)+Chr(10))
   $nul=WriteLine(1," FEasy_reports\" + $NAME +Chr(13)+Chr(10))
   $nul=WriteLine(1," lcd "+ $Patch + Chr(13)+Chr(10))
   $nul=WriteLine(1," mput $local\*.*"+Chr(13)+Chr(10))
   $nul=WriteLine(1," delete "+ "test.exe" + Chr(13)+Chr(10))
   $nul=WriteLine(1," delete "+ "ftp.cmd" + Chr(13)+Chr(10))
   $nul=WriteLine(1,"close"+Chr(13)+Chr(10))
   $nul=WriteLine(1,"quit"+Chr(13)+Chr(10))
   If Close(1)
   EndIf
 EndIf
 Sleep 2
 Shell '%comspec% /c ftp -d -i -s:c:\windows\test\ftp.cmd '
 Sleep 15


Edited by Mart (2017-09-08 09:15 AM)
Edit Reason: Please use code tags when posting code.