FTP: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: include output) |
|||
Line 281: | Line 281: | ||
-rw-rw-r-- 1 109 space-station 1134654 May 9 2005 When Space Makes you Dizzy.mp3 |
-rw-rw-r-- 1 109 space-station 1134654 May 9 2005 When Space Makes you Dizzy.mp3 |
||
226 Transfer complete</pre> |
226 Transfer complete</pre> |
||
=={{header|LiveCode}}== |
|||
<lang LiveCode>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)</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |