how to download a folder from a ftp server ?
Dave Cragg
dcragg at lacscentre.co.uk
Fri Sep 2 02:21:06 EDT 2005
On 2 Sep 2005, at 00:21, Mark Smith wrote:
> put the path to the directory you want into a variable:
>
> put URL ("ftp:" & pathToYourRemoteDirectory) into fList
> --this puts a list of the files into variable fList
> -- each line in fList will look something like:
> --09-01-05 03:55PM 298694 myfile.doc
> -- where (in this case) word -1 of each line is the name of the
> file or folder
>
Just a couple of small additions. Using "word 9" is probably safer
than using "word -1" to get the name of the file. The reason is that
additional data can appear after the file name, for example, if the
file is a link to another file. Using word 9 assumes the ftp server
is returning directory listings in standard Unix format (which is the
case with most servers, even on Windows).
drwxr-x--- 3 dave staff 102 Mar 29 2003 liburltestaxx
-rwxr--r-- 1 dave staff 981 Apr 8 2002 urlconfig.mc
(If you know in advance the server you are dealing with, you should
probably confirm the directory listing format before you make your
script.)
To distinguish directories from files, check that char 1 in any line
of the listing = "d".
Cheers
Dave
More information about the use-livecode
mailing list