You are here:

ActiveXperts.com > ActiveSocket > Objects > Ftp & FtpFile

ActiveSocket Toolkit Add network capabilities to any Windows or .NET application

Quicklinks


ActiveSocket - Ftp and FtpFile Objects

Today, there are many FTP software packages available. However, most of these software tools are stand-alone packages, without scripting options. ActiveSocket is very well suited for scripting and embedding in applications.

Use the ActiveSocket Ftp object to script the following:

  • Connect to a remote FTP server;
  • Log on as an anonymous user, or log on using a login and a password;
  • Change directory;
  • Download files (ftp 'get'), ASCII or binary;
  • Upload files (ftp 'put'), ASCII or binary;

The Ftp object is part of the ActiveSocket component. Overview of all ActiveSocket objects:

Ftp Sample code

VBScript sample: Ftp directory listing sample

   Set objFtp = CreateObject ( "ActiveXperts.FtpServer" )
  
   objFtp.Connect  "ftp.activexperts-labs.com" , "", "" 
   WScript.Echo "Connect, result: " & objFtp.LastError
   If( objFtp.LastError <> 0 ) Then
     WScript.Quit
   End If
   WScript.Echo objFtp.GetCurrentDir 
   Set objFtpFile = objFtp.FindFirstFile()
   While ( objFtp.LastError = 0 )
      WScript.Echo "File: " & objFtpFile.Name
      WScript.Echo "  Size: " & objFtpFile.Size
      Set objFtpFile = objFtp.FindNextFile ()
   Wend
    
   objFtp.Disconnect
   WScript.Echo "Ready."

On ftp.activexperts-labs.com, you can find a lot of ActiveSocket samples. These samples are also part of the ActiveSocket installation.

Visit ftp.activexperts-labs.com