40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
libURLSetFTPMode "passive" --default is passive anyway
|
|
put url "ftp://ftp.hq.nasa.gov/" into listing
|
|
repeat for each line ftpln in listing
|
|
set itemdel to space
|
|
if the first char of (the first item of ftpln) is "d" then
|
|
-- is a directory
|
|
put the last item of ftpln after dirlist
|
|
else
|
|
put the last item of ftpln after filelist
|
|
end if
|
|
end repeat
|
|
|
|
put listing //(subset)
|
|
// -rw-r--r-- 1 ftpadmin ftp-adm 3997 May 26 1998 README
|
|
// drwxrwsr-x 17 ftpadmin ftp-adm 4096 Sep 10 16:08 pub
|
|
|
|
put dirlist
|
|
// armd
|
|
// chmgt
|
|
// incoming
|
|
// lost+found
|
|
// office
|
|
// pub
|
|
|
|
put filelist
|
|
// README
|
|
// ftp-exec
|
|
// index.html
|
|
// robots.txt
|
|
|
|
-- downloading a file (upload is same, but use put)
|
|
-- you don't have to cd manually
|
|
-- file up/down transfer is binary in livecode (always enforced by livecode)
|
|
put URL "ftp://ftp.hq.nasa.gov/pub/robots.txt" into URL "file:myFile.txt"
|
|
|
|
You can execute any ftp command using the libURLftpCommand command
|
|
e.g. to know the working directory, issue "pwd", we could issue "list" for above too,
|
|
but using an url with slash on the end with the ftp protocol causes a dir listing by default.
|
|
put libURLftpCommand("PWD",ftp.example.org)
|