Re: How do I get an output file after running ftp in vbs?
- From: "McKirahan" <News@xxxxxxxxxxxxx>
- Date: Tue, 22 Nov 2005 12:59:08 -0600
"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
.
- References:
- Prev by Date: Re: Login Script refuses to map a share?
- Next by Date: Re: How do I get an output file after running ftp in vbs?
- Previous by thread: How do I get an output file after running ftp in vbs?
- Next by thread: Re: How do I get an output file after running ftp in vbs?
- Index(es):
Relevant Pages
|