Create object names "basp21.FTP" by CreateObject Method.
   Set ftp = Server.CreateObject("basp21.FTP")   ' ASP
   Set ftp = CreateObject("basp21.FTP")          ' VBA or VB
   Set ftp = WScript.CreateObject("basp21.FTP")  ' WSH
Call method of Object you just created.
variable = ftp.method_name(parameter)
Connects to the FTP server.
rc = ftp.Connect(dest,user,pass)
svr  [in]  : Internet Protocol address or network host name at connection
             destination. 
             server-name[:port][:time-out].
             The port number (default value 21) and the time-out value
             (default value 120 second) can be specified by delimiting ":".
user [in]  : user name.
pass [in]  : password.
rc [out]  : The result code.
  0 : Method completed successfully.
  1 - 5 : Error. Call the GetReply method, and examine details in the FTP
          response text. 
  10000 or more : Winsock Error.
  -1 : Socket opening error.
  -2 : Time-out
Example:
rc = ftp.Connect("ftp.microsoft.com:21:120","anonymous","who@who.com")
 
Retrieves a file or files from the FTP server and stores it under the specified file name.
rc = ftp.GetFile(remote,local[,type])
remote [in]  : Remote file name. The delimitation of the directory uses "/".
               The specification of multiple files uses "*" like "*" and "*. html" etc.
               "*" can be used only once. For instance, "* aa*.txt" cannot be specified.
               Example: a.html --- a.html of current directory
                    html/a.html --- a.html of html directory
                    html/*.html --- All html files of html directory
                    html/*      --- All files of html directory
local [in]   : File name or directory name of local (machine which is operation of BASP21). 
               Please specify the directory name at multiple files.
type  [in]   :The received data type is specified as follows. 
  0 : ASCII (Default value).
  1 : BINARY.
rc [out]  : The result code.
  1 or more : Method completed successfully. Transmitted number of files. 
  0   : Error. File not found.
  other : Error. Call the GetReply method, and examine details in the FTP
          response text. 
Example:
rc = ftp.GetFile("html/index.html","c:\temp\html")
rc = ftp.GetFile("html/index.html","c:\temp\html\index2.html")
rc = ftp.GetFile("html/*.html","c:\temp\html")
rc = ftp.GetFile("html/images/*","c:\temp\image",1)
 
Stores a file or files on the FTP server.
rc = ftp.PutFile(local,remote[,type])
local [in]  : The transmitted file name is specified by fully qualified.
               The specification of multiple files uses "*" like "*" and "*. html" etc.
               "*" can be used only once. For instance, "* aa*.txt" cannot be specified.
               Example:
                    c:\html\a.html --- a.html of html directory
                    c:\html\*.html --- All html files of html directory
                    c:\html\*      --- All files of html directory
remote [in]   : The directory name of the file to create on the remote system. 
                ""is current directory. 
type  [in]   :The sending data type is specified as follows. 
  0 : ASCII (Default value).
  1 : BINARY.
rc [out]  : The result code.
  1 or more : Method completed successfully. Transmitted number of files. 
  0   : Error. File not found.
  other : Error. Call the GetReply method, and examine details in the FTP
          response text. 
Example:
rc = ftp.PutFile("c:\html\index.html","html")
rc = ftp.PutFile("c:\html\*.html","html")
rc = ftp.PutFile("c:\html\images\*","html/images",1)
 
The file changed today is transmitted. It is convenient to transmit only the changed file. 
rc = ftp.PutToday(local,remote[,type])
local [in]  : The transmitted file name is specified by fully qualified.
               The specification of multiple files uses "*" like "*" and "*. html" etc.
               "*" can be used only once. For instance, "* aa*.txt" cannot be specified.
               Example:
                    c:\html\a.html --- a.html of html directory
                    c:\html\*.html --- All html files of html directory
                    c:\html\*      --- All files of html directory
remote [in]   : The directory name of the file to create on the remote system. 
                ""is current directory. 
type  [in]   :The sending data type is specified as follows. 
  0 : ASCII (Default value).
  1 : BINARY.
rc [out]  : The result code.
  1 or more : Method completed successfully. Transmitted number of files. 
  0   : File not found.
  other : Error. Call the GetReply method, and examine details in the FTP
          response text. 
Example:
rc = ftp.PutToday("c:\html\*.html","html")
 
Deletes a file stored on the FTP server.
rc = ftp.DeleteFile(remote)
remote [in]  : Remote file name. The delimitation of the directory uses "/".
               The specification of multiple files uses "*" like "*" and "*. html" etc.
               "*" can be used only once. For instance, "* aa*.txt" cannot be specified.
               Example: a.html --- a.html of current directory
                    html/a.html --- a.html of html directory
                    html/*.html --- All html files of html directory
                    html/*      --- All files of html directory
rc [out]  : The result code.
  1 or more : Method completed successfully. Deleted number of files. 
  other : Error. Call the GetReply method, and examine details in the FTP
          response text. 
Example:
rc =ftp.DeleteFile("html/*")
 
Renames a file stored on the FTP server.
rc = ftp.RenameFile(old,new)
old [in]  : the name of the file that will have its name changed on the remote FTP server. 
new [in]  : the new name for the remote file. 
rc [out]  : The result code.
  2 : Method completed successfully. 
  other : Error. Call the GetReply method, and examine details in the FTP
          response text. 
Example:
rc = ftp.RenameFile("html/index.html","html/top.html")   ' index.html -> top.html
 
The file list is returned by the array. 
farray = ftp.GetDir(remote[,mode])
remote [in]  : Remote directory name.
mode   [in]  : Kind of file list. 
  0 : Default value. Only the file name. 
  1 : Only the directory name. 
  2 : LIST format. The result of the LIST command is returned.
  3 : NLST format. The result of the NLST command is returned.
farray [out]  : The result is returned by the array. The array is not returned
                 when there are neither an error nor an entry. 
Example:
rc = ftp.GetDir("")   ' File list of current directory
 
Send a command directly to an FTP server. The command with a data transfer such as STOR/RETR/LIST/NLST cannot be executed.
rc = ftp.Command(cmd)
cmd [in]  : Command name and parameter. The command which can be executed is
            different according to the FTP server. 
            The following commands are defined in the FTP protocol. 
            - HELP [command]  ---  send helpful information regarding its implementation
            - CMD path  --- change working directory
            - CDUP      --- change parent directory
            - RMD path  --- remove directory
            - MKD path  --- make directory
            - SITE command --- execute site command
rc [out]  : The result code.
  2 : Method completed successfully. 
  -1 : STOR/RETR/LIST/NLST cannot execute.
  other : Error. Call the GetReply method, and examine details in the FTP
          response text. 
Example:
rc = ftp.Command("HELP")   ' HELP command
help = ftp.GetReply()   ' get reply
The content of help (Differ according to the server):
214-The following commands are recognized (* =>'s unimplemented).
   USER    PORT    STOR    MSAM*   RNTO    NLST    MKD     CDUP    PBSZ*
   PASS    PASV    APPE    MRSQ*   ABOR    SITE    XMKD    XCUP    PROT*
   ACCT*   TYPE    MLFL*   MRCP*   DELE    SYST    RMD     STOU    SIZE 
   SMNT*   STRU    MAIL*   ALLO    CWD     STAT    XRMD    AUTH*   MDTM 
   REIN*   MODE    MSND*   REST    XCWD    HELP    PWD     ADAT*
   QUIT    RETR    MSOM*   RNFR    LIST    NOOP    XPWD    CCC*
214 Direct comments to ftp-bugs@server1.
rc = ftp.Command("HELP SITE")   ' HELP SITE command
helpsite = ftp.GetReply()   ' get reply
The content of helpsite (Differ according to the server):
214-The following SITE commands are recognized (* =>'s unimplemented).
   UMASK   IDLE    CHMOD   HELP 
214 Direct comments to ftp-bugs@server1.
rc = ftp.Command("HELP SITE CHMOD")   ' HELP SITE CHMOD command
helpchmod = ftp.GetReply()   ' get reply
The content of helpchmod (Differ according to the server):
214 Syntax: SITE CHMOD  mode  file-name
  
 
The response text of the FTP command is received. 
Details of the error and the execution result of the Command method are received. 
text = ftp.GetReply()
text [out]  : The response text is returned by the character string.
              CRLF is included when extending to two or more lines. 
Example:
text = ftp.GetReplay()
 
Open the log file. The exchange of the FTP command with the FTP server
 is preserved in the text file. 
rc = ftp.OpenLog(file[,mode])
file [in]  : The file name is specified by fully qualified.
mode [in]  : 0 - newly created. 1 - append mode.
rc [out]  : The result code.
  0 : Method completed successfully. 
  other : Error.
Example:
rc = ftp.OpenLog("c:\ftplog.txt",1)   ' append
 
Close the log file.rc = ftp.CloseLog() rc [out] : The result code. 0 : Method completed successfully. other : Error. Example: rc = ftp.CloseLog()
Close connection.Example: ftp.Close
Visual Basic
Private Sub Form_Load() Dim ftp As Object, rc As Long, v As Variant, v2 As Variant Dim ctr As Long Set ftp = CreateObject("basp21.FTP") ftp.OpenLog "c:\temp\log.txt" rc = ftp.Connect("ftp.microsoft.com", "anonymous", "") If rc = 0 Then v = ftp.GetDir("bussys/winnt/winnt-public", 2) If IsArray(v) Then For Each v2 In v Debug.Print v2 Next End If v = ftp.GetDir("bussys/winnt/winnt-public") If IsArray(v) Then For Each v2 In v Debug.Print v2 Next End If rc = ftp.GetFile("bussys/winnt/winnt-public/*", "c:\temp") End If End End Sub WSH
set bobj=createobject("basp21") set ftp=createobject("basp21.FTP") Set WshShell = Wscript.CreateObject("Wscript.Shell") WshShell.Run ("notepad") ftp.OpenLog "c:\temp\log.txt" rc = ftp.Connect("ftp.microsoft.com", "anonymous", "") If rc = 0 Then v = ftp.GetDir("bussys/winnt/winnt-public", 2) bobj.Debug v v = ftp.GetDir("bussys/winnt/winnt-public") bobj.Debug v rc = ftp.GetFile("bussys/winnt/winnt-public/*", "c:\temp") End If