Hi Guys,
How should I execute a FTP Script to do some action on a FTP Server. For example to get all files from a selected directory of a site we should use the command mget *.*. How should I execute this Script so that I can copy all the files from a FTP Site to the Local Harddrive. Advance thanks for those helping...
Suppose you have a node - 10.10.10.10
with: username = john
password hello
directory where you need to find files is c:\mypath
You want all of the files form that directory put into
c:\storage on the machine running the script
Here's the ftp script - we named it myscript.ftp
and it lives in c:\
Code:
open 10.10.10.10
john
hello
cd \mypath
lcd \storage
mget *.*
bye
If we were to pretend that you wanted to run the script interactively at the DOS prompt, the command to run it is:
ftp -is:c:myscript.ftp
If you want to run this from inside VB
Code:
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Sub RunFTP()
Dim WindowsDir as string
Dim retval as long, nSize as Long
Dim cmd$
WindowsDir = Space(255)
retval = GetWindowsDirectory(WindowsDir, nSize)
WindowsDir = left(WindowsDir, nSize)
cmd$ = WindowsDir & "ftp -is:c:myscript.ftp"
Shell cmd$, vbNormalFocus
End Sub