Hi All,
As i can't find related document from website .
Would you mind advise how can i run a batch file that can put a text file into SFTP server?As i know,SFTP should import a certificate for Secure FTP.I can't get detail concept for that.
I have the old version in FTP script,but it is no information for modfiy as SFTP version.
_______________________________________________________________________________________________________________________________________________________________________
Randomize()
sDate = Year(Now()) & Right("00" & Month(Now()), 2) & Right("00" & Day(Now()), 2) & Right("00" & Hour(Now()), 2) & Right("00" & Minute(Now()), 2) & Right("00" & Second(Now()), 2) & "-" & Right("00" & (Int((100)*Rnd)),2)
Set WshShell = CreateObject("WScript.Shell")
user = "testftp"
pass = "ftppassword"
ip = "192.168.10.10"
Set fs = CreateObject("Scripting.FileSystemObject") 'file withthe commands for ftp
Set objArgs = WScript.Arguments
strScriptPath = Wscript.ScriptFullName
'Wscript.Echo strScriptPath
strScriptFolder = Left(strScriptPath, Len(strScriptPath) - Len(Wscript.ScriptName) - 1)
'Wscript.Echo strScriptFolder
Wscript.Echo sDate
If len(sms_description) > 100 Then
sms_description = left(sms_description,100)
End If
sms_msg1 = "85212345678" & VBTab & sms_no1 & VBTab & sms_description
Wscript.Echo sms_msg1
sms_log1 = strScriptFolder & "\sms-test1_message_" & sDate
Set sms1 = fs.CreateTextFile(sms_log1, True)
sms1.WriteLine (sms_msg1)
sms1.Close
sms_msg2 = "85212345678" & VBTab & sms_no2 & VBTab & sms_description
Wscript.Echo sms_msg2
sms_log2 = strScriptFolder & "\sms-test2_message_" & sDate
Set sms2 = fs.CreateTextFile(sms_log2, True)
sms2.WriteLine (sms_msg2)
sms2.Close
sms_msg3 = "85212345678" & VBTab & sms_no3 & VBTab & sms_description
Wscript.Echo sms_msg3
sms_log3 = strScriptFolder & "\sms-test3_message_" & sDate
Set sms3 = fs.CreateTextFile(sms_log3, True)
sms3.WriteLine (sms_msg3)
sms3.Close
ftp_cmd = strScriptFolder & "\ftp_upload-" & Right("00" & (Int((100)*Rnd)),2) & ".cmd"
ftp_info = strScriptFolder & "\ftp_info-" & Right("00" & (Int((100)*Rnd)),2) & ".txt"
Set info = fs.CreateTextFile(ftp_info, True)
info.WriteLine (user)
info.WriteLine (pass)
info.WriteLine ("ascii")
info.WriteLine ("put """ & sms_log1 & """")
info.WriteLine ("put """ & sms_log2 & """")
info.WriteLine ("put """ & sms_log3 & """")
info.WriteLine ("bye")
info.Close
Set cmdLine = fs.CreateTextFile(ftp_cmd, True)
cmdLine.WriteLine ("ftp -i -s:""" & ftp_info & """ " & ip)
cmdLine.Close
WshShell.Run """" & ftp_cmd & """",0,true
Set oAPI = CreateObject("MOM.ScriptAPI")
Call oAPI.LogScriptEvent("Test SMS",101,10,"1." & sms_msg1 & ",2." & sms_msg2 & " Sent.")
rem fs.DeleteFile(sms_log1)
rem fs.DeleteFile(sms_log2)
rem fs.DeleteFile(sms_log3)
fs.DeleteFile(ftp_info)
fs.DeleteFile(ftp_cmd)
Wscript.Echo "End of Script."
_______________________________________________________________________________________________________________________________________________________________________