I have a script that FTPs files to a remote server using the code below:
Set objShell = CreateObject("WSCRIPT.SHELL")
Set objFso = WScript.CreateObject("Scripting.FileSystemObject")
Set myFile=objFso.CreateTextFile("c:\ftprun.txt", True)
myFile.WriteLine "open " & strServer
myFile.WriteLine strLogin
myFile.WriteLine strPassword
myFile.WriteLine "put " & strLocalDir & strFileName1 & " " & strServerDir & strFileName1
myFile.WriteLine "put " & strLocalDir & strFileName2 & " " & strServerDir & strFileName2
myFile.WriteLine "put " & strLocalDir & strFileName3 & " " & strServerDir & strFileName3
myFile.WriteLine "bye"
myFile.Close
set oShell = CreateObject("WScript.shell")
oShell.run "ftp.exe -s:ftprun.txt", , True
In most cases this would be successful but to be sure I would like to connect again afterwards and run a directory listing to check the files have actually been received.
Is it possible to connect, run "ls" and have the output sent to a local file that can be subsequently read?
Any help would be appreciated.
Set objShell = CreateObject("WSCRIPT.SHELL")
Set objFso = WScript.CreateObject("Scripting.FileSystemObject")
Set myFile=objFso.CreateTextFile("c:\ftprun.txt", True)
myFile.WriteLine "open " & strServer
myFile.WriteLine strLogin
myFile.WriteLine strPassword
myFile.WriteLine "put " & strLocalDir & strFileName1 & " " & strServerDir & strFileName1
myFile.WriteLine "put " & strLocalDir & strFileName2 & " " & strServerDir & strFileName2
myFile.WriteLine "put " & strLocalDir & strFileName3 & " " & strServerDir & strFileName3
myFile.WriteLine "bye"
myFile.Close
set oShell = CreateObject("WScript.shell")
oShell.run "ftp.exe -s:ftprun.txt", , True
In most cases this would be successful but to be sure I would like to connect again afterwards and run a directory listing to check the files have actually been received.
Is it possible to connect, run "ls" and have the output sent to a local file that can be subsequently read?
Any help would be appreciated.