FTP file or directory

Just starting out? Need help? Post your questions and find answers here.
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

FTP file or directory

Post by nessie »

Does anyone know how to get the attributes of a file or directory on an FTP server. i.e. 1 if it's a file or 2 if it's a directory. I've tried the usual directory commands but they just crash my routine. :?:
Seldon
Enthusiast
Enthusiast
Posts: 405
Joined: Fri Aug 22, 2003 7:12 am
Location: Italia

Post by Seldon »

Once you have logged, to have a list of files on the server, you must open a data connection (send to server the PASV command). The server replies with an IP address with 2 more bytes. The first 4 bytes are the IP and the last 2 are the port. Open this new connection and send on the previous opened connection (port 21) the command LIST. Wait and get a directory dump from the data connection. I'm doing a FTP client which doesn't use Windows FTP-API, as soon as it's finished I'll post the code.
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Thanks

Post by nessie »

Seldon, You've been a great help. I look forward to your post.
Post Reply