more ftp informations
[1/12] from: etienne:alaurent:free at: 20-Jul-2001 0:55
Hi, Rebolers,
I'm working on an ftp client for my app.
I saw the doc for Core 5.1, and I'm not able to write a correct code do read
the structure of my ftp directory.
The code is :
all-files: copy []
system/schemes/ftp/passive: true
foreach file read to-url chemin [
print file
append all-files file
]
where chemin is somethinq like ftp://user:[pass--my--site--com]/dir where dir can be
an empty string or the path to a subdir I can find in all-files.
I want to know infos about all files in all-files (is a directory, time, size,
...).
Can you tell me if this code is ok? and how can I obtain infos about a file?
(I know the info? instruction, but I don't know how to use it)
I tryed :
ftp-port: open to-url chemin
forall ftp-port [
file: first ftp-port
info: info? file
print [file info/date info/size info/type]
append all-files file
]
close ftp-port
but it doesn't work. Why ?
Thanks to anybody witch can answer me.
---
Etienne
[2/12] from: larry::ecotope::com at: 19-Jul-2001 16:50
Hi Etienne
Have a look at ftpdemo.r in the View script library under ftp, it works with
both View and Core.
There are also a number of other ftp scripts under the ftp icon.
The short answer is ftp dirs look and work just like dirs on your hard disk.
-Larry
[3/12] from: arolls::bigpond::net::au at: 20-Jul-2001 17:08
Re: more ftp informations - final slash
Put a slash on the end of your path (chemin):
ftp://user:[pass--my--site--com]/dir/
> > where chemin is somethinq like ftp://user:[pass--my--site--com]/dir
It is a directory, very important to have the final slash.
[4/12] from: etienne:alaurent:free at: 20-Jul-2001 16:47
still more ftp informations
hi, Rebolers, Larry, Anton
>(Anton) Put a slash on the end of your path (chemin)
I've done this. But it doesn't work like I want.
>(Larry)Have a look at ftpdemo.r in the View script library under ftp, it works
>with both View and Core.
I had a look and I wrote my ftp client like all these examples. But I have
always troubles : I can read an ftp directory. It's ok. But I can't have any
information with info?. I tested with a known file and I obtained this error
message :
** Script Error: empty? expected series argument of type: series port
** Where: dir-read?
** Near: info? ftp://user:[pass--my--site--com]/index.html
(where user is my login, pass is my password, my.site.com is my ftp server)
and, when I rescan the toplevel dir, I obtain this error message from REBOL
and the ftp server :
The connexion is not closed after the dir scan. Why ? is there toubles in the
ftp protocol ?
I tested also the ftpdemo.r file, and it worked fine (but ftp://ftp.rebol.com
is an anonymous server here)
>(Larry)The short answer is ftp dirs look and work just like dirs on your hard
>disk.
Ok. How can I change the current directory ? (with files I use change-dir)
---
Etienne
[5/12] from: etienne:alaurent:free at: 20-Jul-2001 18:53
Re: still more ftp informations - missed something
I missed to complete my Email :
and, when I rescan the toplevel dir, I obtain this error message from REBOL
and the ftp server :
** User Error: Server error: tcp 530 Already connected
** Near: foreach file read to-url chemin
[6/12] from: max::ordigraphe::com at: 20-Jul-2001 13:58
Re: still more ftp informations
> -----Original Message-----
> From: Etienne ALAURENT
<<quoted lines omitted: 6>>
> (where user is my login, pass is my password, my.site.com is
> my ftp server)
funny, that the error I get when I scan an empty ftp dir with
permissions!
I guess this doen't help, but it might give you clues in your
troubleshooting...
-Max
[7/12] from: arolls::bigpond::net::au at: 21-Jul-2001 4:39
Re: still more ftp informations - missed something
The ftp scheme caches connections to speed
up directory listing etc.
This could be confusing things.
You can set the number of cached connections
to 0 or 1 somehow...
I think it's system/schemes/ftp/cache-size,
which is 5 by default.
This means up to 5 cached connections are open.
Try also from a fresh rebol.
Other people have had this kind of trouble
on this list, I'll have a look.
Holger has explained it all before.
[8/12] from: etienne:alaurent:free at: 21-Jul-2001 1:49
Re: still more ftp informations
Hi Anton
Le ven, 20 jui 2001, vous avez écrit :
>You can set the number of cached connections
>to 0 or 1 somehow...
>I think it's system/schemes/ftp/cache-size,
>which is 5 by default.
>This means up to 5 cached connections are open.
I set system/schemes/ftp/cache-size to 0, and my script runs ok now :-) Thank
you.
>Other people have had this kind of trouble
>on this list, I'll have a look.
>Holger has explained it all before.
Where can I find the Holger explanation ? I had a look in the mailing list,
and I didn't find it.
How can I check if I have access to a particular directory ? (in one directory
on my ftp server, I get : ** Script Error: ** User Error: Server error: tcp
550 ./mysql/: Permission denied)
---
Etienne
[9/12] from: brett:codeconscious at: 21-Jul-2001 14:06
> I set system/schemes/ftp/cache-size to 0, and my script runs ok now :-)
Thank
> you.
I had the same problem. Worked with one ISP not another. It turned out that
the one with the problem was allowing only 3 connections before it failed.
Once it failed I had to quit that Rebol session and restart a new one. When
I set the cache size
as you have done everything worked very smoothly.
> Where can I find the Holger explanation ? I had a look in the mailing
list,
> and I didn't find it.
This might be what you are looking for (lightly edited):
http://www.codeconscious.com/rebol/rebol-net.html#UsingFTPrecursively
Brett.
[10/12] from: arolls:bigpond:au at: 21-Jul-2001 23:06
> How can I check if I have access to a particular directory ? (in
> one directory
> on my ftp server, I get : ** Script Error: ** User Error: Server
> error: tcp
> 550 ./mysql/: Permission denied)
Well, you could always 'try:
if error? try [read ftp://abcdef.com/adir/
][
print "there was an error"
]
[11/12] from: etienne:alaurent:free at: 21-Jul-2001 18:51
Hi, Anton
Le sam, 21 jui 2001, vous avez écrit :
>Well, you could always 'try:
>
>if error? try [read ftp://abcdef.com/adir/
>][
> print "there was an error"
>]
Oh ! yes ! I forgot I could use error?. Thank you.
Bye
---
Etienne
[12/12] from: etienne:alaurent:free at: 21-Jul-2001 18:53
Hi Brett
Le sam, 21 jui 2001, vous avez écrit :
>> Where can I find the Holger explanation ? I had a look in the mailing
>>list, and I didn't find it.
>
>This might be what you are looking for (lightly edited):
>
>http://www.codeconscious.com/rebol/rebol-net.html#UsingFTPrecursively
>
I found it. Thank you.
Bye
---
Etienne
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted