Posted by webmaster Guido on July 12, 2000 at 15:59:14:
In Reply to: TNMFTP posted by p12030 + Mike Downey on July 11, 2000 at 17:16:12:
: I need some help with my FTP Client.
: I need to know how to distinguish between a Directory and a file name...
If you compile the FTP demo that is included with Delphi 4, you can log into ftp.inprise.com (the default that is coded already in the demo). Note: on high traffic hours, it might be necessary to change the "timeout" in the code, from 5000 to say 10000 or 20000 milliseconds.
Next, you can ask a directory listing, either with NList or List. NList in the root directory gives:
Appearantly this are two directories. We guessed this because there are no dots in the names (no extension). If you ask a listing with List, you get detailed information. For clarity, I replaced the middle part of each line with "..."
drwx------ ... lost+found
drwxr-xr-x ... pub
Each line starts of with a "status" code, that gives you access information (r=read, w=write, and so on... I'm not gonna a course on this here... that's not Delphi stuff :)
Anyway, the first char
acter "d" means "directory".
Let's change the directory to "pub". The command List gives around 20 lines, the last three lines being:
-rw-r--r-- ... startup.pdf
drwxr-xr-x ... vbssl
drwxr-xr-x ... visibroker
The last two are directories. The previous one is a file: the status for startup.pdf does NOT start with "d". Hope this helps! If you still have problems, don't hesitate to post them in our forum.
Related Articles and Replies: