using ftplib

John Salerno johnjsal at NOSPAMgmail.com
Mon May 1 16:09:07 EDT 2006


I'm experimenting with this now and I'm a little confused about 
transferring commands. This might be more of an FTP question than 
strictly Python, but it's still related to how to use the ftplib methods.

Anyway, if what I want to do is send a command to change the file 
permission settings of a file (or files), I assume I would use 
transfercmd() and the command would be something like SITE CHMOD 755 
name.py, for example.

What I'm confused about is why the documentation says to send a PORT or 
PASV command as well. Is this just something that must be done before 
each command?

Also, in order to figure out what the FTP commands are to begin with, I 
did a little testing in FileZilla and I noted what was being displayed 
at the top (things like PORT xxx, STOR xxx, SITE CHMOD, etc. depending 
on what I was doing). So I assume these are the 'cmd' parameter. So here 
are a couple of questions:

1. Are PORT/PASV necessary to start a transfer?

2. Is the cmd parameter some kind of list, or is it just a string and 
you have to call a separate transfercmd() for each command?

3. My burning question: also during every transfer I made in FileZilla, 
I see that it sometimes sends a TYPE A or TYPE I command as well. What 
are these, and are they also necessary when I'm using transfercmd()?

Thanks!
John



More information about the Python-list mailing list