using ftplib

John Salerno johnjsal at NOSPAMgmail.com
Mon May 1 17:37:26 EDT 2006


Dave Hughes wrote:

> Indeed. FTP is a tricky (and _very_ old) protocol that does things in a
> very different manner to the later (simpler) protocols like HTTP. Not
> sure how familiar you are with FTP, so my apologies if I wind up
> repeating stuff you know already:

Thanks very much, all that information was great to have.

> TYPE A indicates that an ASCII transfer is to take place. An ASCII
> transfer is intended for use with text files and indicates that the
> data should be transformed from the native text format on the client
> platform to the native text format on the server platform. For example,
> transferring a file from a DOS/Windows client to a UNIX/Linux platform
> in ASCII mode would convert CRLF line endings (ASCII char 13 + ASCII
> char 10) to LF line endings (ASCII char 10).
> 
> There are other transfer modes as well, though I forget exactly what
> they are (there's probably one for EBCDIC <shudder> :-).
> 
> Take a look at the storbinary, storlines, retrbinary and retrlines
> methods of the FTP object: looks like they perform the appropriate TYPE
> command for you, then pass the specified command to transfercmd.

So if I already have files on the server and I want to change file 
permissions, do I need to mess with TYPE A/TYPE I commands, or are those 
strictly for when you *transfer* files? Because I just did a quick test 
of changing file permissions through my FTP program, and it still sent a 
TYPE A command in the process. I know that the retr and stor methods 
might do this automatically, but if I don't need to use those, and just 
need to use transfercmd (assuming this *is* the right method to use when 
changing file permissions), do I need to manually send a TYPE A/I 
command as well?



More information about the Python-list mailing list