Leshgan Цитата: Я сейчас как раз разбираюсь с FTP. Взял примерчик из Delphi 5. Из раздела FastNet. С помощью компоненты NMFTP можно получить список файлов на FTP сервере. Имея этот спсок ты можешь их всех скачать.
незнаю мне больше как-то по душе
ICS Delphi Компоненты
FTPClient Component Properties:
HostName - FTP server host name or IP address
UserName - User name for authentication on FTP server
PassWord - Passwor needed for user, can be blank
HostDirName - Directory as knwon of FTP server
HostFileName - File name as known on FTP server
LocalFileName - Local file name (complete path)
Binary - Select binary or ascii file transfert (Need to call TypeSet
or TypeSetAsync to send it to FTP server).
(There are other less used properties, see code below)
Methods:
Open - Open the connection with the FTP server
User - Send username
Pass - Send password
Connect - Open the connection, send username and password
Quit - Disconnect gracefully from FTP server
Abort - Disconnect (close connection) immediately
AbortXfer - Abort file transfer without disconnecting.
Warning: LocalFilename property is lost after this command.
Pwd - Get current working directory
Cwd - Change Working Directory
CDup - Change to parent directory
TypeSet - Set type for file transfert (see Binary property)
TypeBinary - Set to binary type transfert and call TypeSet
TypeAscii - Set to ascii type transfert and call TypeSet
Put - Upload a file
Transmit - Connect, Cwd, Upload a file & Quit
Append - Upload a file, appending to existing
AppendFile - Connect, Cwd, Append a file & Quit
Get - Download a file
Receive - Connect, Cwd, Download a file & Quit
RestGet - Download a file, restarting from current local file size
RestartGet - Connect, Cwd, Restart downloading a file & Quit
RestPut - Upload a file, restarting from ResumeAt property value
RestartPut - Connect, Cwd, Restart uploading a file & Quit
Dir - Download a directory listing to a file
Directory - Connect, Cwd, Download a directory listing to a file & Quit
Ls - Download a file name listing to a file
List - Connect, Cwd, Download a file name listing to a file & Quit
Mkd - Create a directory on the server
Mkdir - Connect, Cwd, Create a directory on the server & Quit
Ren - Rename a file or directory on the server
Rename - Connect, Cwd, Rename a file or directory on the server & Quit
Dele - Delete a file on the server
Delete - Connect, Cwd, Delete a file on the server & Quit
Rmd - Remove a directoy from the server
Rmdir - Connect, Cwd, Remove a directoy from the server & Quit
Syst - Get system information from the server
System - Connect, Cwd, Get system information from the server & Quit
Size - Get file size
FileSize - Connect, Cwd, get file size & Quit
Quote - Send literal command (use LocalFileName as command to send)
DoQuote - Connect, Cwd, send literal command & Quit
(There are two set of methods: Async and Sync. The Async are the prefered
ones to build robust applications. Their name end with Async like GetAsync)
(There are other less used methods, see code below)
How to use a Proxy or Firewall ?
First of all, not all proxies or firewalls are the same. So have a look at
product documentation. However, most products support a transparent proxy
which doesn't require any special programming:
1) Instead of connection to a remote FTP server, you connect to the proxy
2) User name is replaced by user name, followed by '@' sign then followed
by target remote FTP server host name.
3) Password is usual remote FTP server password.
4) Most require using Passive mode.
Example: You want to connect to ftp.borland.com, using anonymous connection,
company firewall/proxy is running on host named proxyserver.
FtpCli1.HostName := 'proxyserver';
FtpCli1.UserName := 'anonymous@ftp.borland.com';
FtpCli1.Password := 'your.email@company';
FtpCli1.Passive := TRUE;