Re: How do I get an output file after running ftp in vbs?



"Ms.Vbs" <amalik@xxxxxxxxxxxxxxx> wrote in message
news:1132682131.023032.175690@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello
>
> I am relatively new to VBS and this is what my code for basic ftp sub
> looks like so far
>
> Set wshShell = WScript.CreateObject("WScript.Shell")
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
> Set logfolder = fso.GetFolder(path)
> tname = fso.GetTempName
> Set fpFtpFile = tfolder.CreateTextFile(tname)
>
> 'Create logFile with datetime stamp
> strDate = Year(Now) & "-" & Right("0" & Month(Now),2) & "-" &
> Right("0" & Day(Now),2)
> tlogname = "ftplog" & strDate & ".txt"
> Set fpFtpLog = logfolder.CreateTextFile(tlogname)
>
>
> ftpCommandLog = path & "\" & tlogname
> ftpCommandFile = tfolder & "\" & tname
>
> ' write ftp commands in the temporary file
>
> With fpFtpFile
> .WriteLine "open " & host
> .WriteLine user
> .WriteLine pass
> '.WriteLine "bell"
> .WriteLine "lcd " & chr(34) & path & chr(34)
> .WriteLine "binary"
> .WriteLine "put " & chr(34) & fileName & chr(34)
> '.WriteLine "close"
> '.WriteLine "bye"
> .WriteLine "echo " & ftpCommandLog
> .Close
> End With
>
> ' Execute Windows' ftp command using the command file created above
> wshShell.Run "ftp -i -s:" & ftpCommandFile & " >" & ftpCommandLog, 5,
> True
>
>
>
>
> My ftpCommandLog file is created but it is completely empty. I would
> like all the command lines from wshShell to be logged in this txt file.
> What am I missing and what can I do to correct it
>
> thanks
> Anna
>

I haven't looked closely at your script but try the following:

wshShell.Run "%comspec% /C ftp -i -s:" & ftpCommandFile & " >>" &
ftpCommandLog, 5, True

Also, what is this line supposed to do?

.WriteLine "echo " & ftpCommandLog


.



Relevant Pages

  • Re: Need a kick in the Butt on FTP from AS/400 to PC or FTP Server
    ... OVRDBF FILETOFILE ... The INPUT file is the file that has the ftp commands including the ...
    (comp.sys.ibm.as400.misc)
  • How do I get an output file after running ftp in vbs?
    ... I am relatively new to VBS and this is what my code for basic ftp sub ... Set wshShell = WScript.CreateObject ... ' write ftp commands in the temporary file ... .WriteLine user ...
    (microsoft.public.scripting.vbscript)
  • Re: FTP in DTS
    ... Do you have any sample code for command line ftp commands? ... >compatible with SQL Server 7.0 DTS too. ... >> the internet site for source and provide an ftp site on ...
    (microsoft.public.sqlserver.dts)
  • FW: [HP3000-L] I/O read error in FTP stream job
    ... I tried Paul Christidis' suggestion and it worked great. ... I also tried putting the FTP commands into a permanent file and then using ... The problem is do to the 'in-line' FTP commands. ... To join/leave the list, search archives, change list settings, * ...
    (comp.sys.hp.mpe)