الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

FTP in python

بدأه the.scorpion في 1 أبريل 2014 · 0 رد · 522 مشاهدة · في لغة Python
مشاركة: واتساب X فيسبوك تيليجرام
#1

import ftplib

ftp = ftplib.FTP('ftp.sunet.se', 'anonymous', 'anonymous@sunet.se')

print "File List: "

files = ftp.dir()

print files

ftp.cwd("/pub/unix") #changing to /pub/unix

Common FTP Methods

FTP.connect(host[, port[, timeout]])

Connect to the given host and port

FTP.getwelcome()

Return the welcome message sent by the server in reply to the initial connection

FTP.login([user[, passwd[, acct]]])

Log in as the given user

FTP.retrbinary(command, callback[, maxblocksize[, rest]])

Retrieve a file in binary transfer mode

FTP.retrlines(command[, callback])

Retrieve a file or directory listing in ASCII transfer mode

FTP.dir(argument[, ...])

Produce a directory listing as returned by the LIST command, printing it to

standard output

FTP.delete(filename)

Remove the file named filename from the server

FTP.cwd(pathname)

Set the current directory on the server

FTP.mkd(pathname)

Create a new directory on the server

FTP.pwd()

Return the pathname of the current directory on the server

FTP.quit()

Send a QUIT command to the server and close the connection

FTP.close()

Close the connection unilaterally

This should not be applied to an already closed connection such as after a

successful call to quit()

1

مواضيع مشابهة