Script Not Working , Kindly Help.

September 11, 2010 at 05:31:14
Specs: Windows XP
Dear Experts ,

I have got this piece of script which seems to be written in vbs my question as novice , how to actually execute this . I tried saving it in notepad changing the extension to vbs but what it does it simply opens cmd prompt window with ftp.exe running , Kindly guide me as i want to ftp a certain file (Which contains date strings in the name) . Thanks in advance for help.

sDay = Right("00" & Day(Date - 1), 2)
sMon = Right("00" & Month(Date - 1), 2)
f = "som-" & sDay & "-" & sMon
Set exec = CreateObject("WScript.Shell").Exec("ftp")
exec.StdIn.Write "o 10.162.217.159" & vbNewLine _
& "Username" & vbNewLine _
& "password" & vbNewLine _
& "cd /home/om/ma/som/" & vbNewLine _
& "bi" & vbNewLine _
& "get" & f & vbNewLine _
& "quit" & vbNewLine

Do Until exec.Status
WScript.Sleep 200
Loop
On Error Resume Next
WScript.StdOut.WriteLine exec.StdOut.ReadAll
WScript.Quit exec.ExitCode


See More: Script Not Working , Kindly Help.

Report •

#1
September 12, 2010 at 15:10:18
The script appears to be valid. I'd have to see the output of FTP to know what's going wrong.

Report •

#2
September 13, 2010 at 04:37:30
The output of the script is it just simply opens cmd and ftp in it, Password is written in that window ,

Report •

#3
September 13, 2010 at 05:23:36
& "get<space>" & f & vbNewLine _

GNU win32 packages | Gawk


Report •

Related Solutions

#4
September 13, 2010 at 06:13:05
After making the followin changes mentioned in bold below . The output is still the same at cmd Password: is appearing and the cursor is blinking but one thing when i hit enter it moves on the file is created on the root directory which i am trying to ftp and than the script terminates itself .

sDay = Right("00" & Day(Date - 1), 2)
sMon = Right("00" & Month(Date - 1), 2)
f = "so-" & sDay & "-" & sMon &".txt.Z"
Set exec = CreateObject("WScript.Shell").Exec("ftp")
exec.StdIn.Write "o 10.**.**.**" & vbNewLine _
& "username" & vbNewLine _
& "password" & vbNewLine _
& "cd /ho/om/ma/so/ " & vbNewLine _
& "bin" & vbNewLine _
& "get " & f & vbNewLine _
& "quit" & vbNewLine

Do Until exec.Status
WScript.Sleep 200
Loop
On Error Resume Next
WScript.StdOut.WriteLine exec.StdOut.ReadAll
WScript.Quit exec.ExitCode


Report •

#5
September 13, 2010 at 18:29:26
please read ftp /? . The way to do automated ftp is to use -s with another file with your ftp commands!

GNU win32 packages | Gawk


Report •

Ask Question