Hello,

I am writing a program that needs to pull all of the files from a
specific directory. I have a few lines written that give me the list
of files but when I try to assign it to a variable the variable ends
up equaling "226 Directory send Ok", this is a snippet of my code.

ftp=FTP(ftpserver)
ftp.login(user=username,passwd=password)
ftp.cwd(remoteworkdir)
listoffiles = ftp.retrlines('NLST')
print listoffiles
ftp.quit()

The output I get is:

sampleone
samplethree
sampletwo
226 Directory send OK.

The list of files I get is just from running the ftp.retrlines command
it isn't because of the variable printing. If I do it without the
assignment of the listoffiles variable it just lists the files from
running that command and the Directory send OK isn't there.

Any ideas on how I can assign just the list of files to a variable
that I can do a for loop to go through and download?

Thank you,

Pat
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to