Re: [Tutor] Assigning a variable to an FTP directory listing

2013-12-12 Thread Pat Martin
Below is what worked for me, thank you. I had a feeling it had to do with the callback but have never dealt with callbacks before so wasn't sure. Time to do more reading. For those asking about alternatives to FTP, its for a vendor who only uses FTP so no choice in that. Thanks all for the help.

Re: [Tutor] Assigning a variable to an FTP directory listing

2013-12-12 Thread Walter Prins
Hi, On 12 December 2013 01:03, Danny Yoo wrote: > By the way, I would recommend not doing this with FTP. If I remember > rightly, it passes passwords in plain text, which is not so good. > Reference: http://en.wikipedia.org/wiki/File_Transfer_Protocol#Security. > You might just want to use so

Re: [Tutor] Assigning a variable to an FTP directory listing

2013-12-11 Thread Danny Yoo
By the way, I would recommend not doing this with FTP. If I remember rightly, it passes passwords in plain text, which is not so good. Reference: http://en.wikipedia.org/wiki/File_Transfer_Protocol#Security. You might just want to use something like 'ssh ls' to run ls on the remote system. There

Re: [Tutor] Assigning a variable to an FTP directory listing

2013-12-11 Thread Alan Gauld
On 11/12/13 23:55, Pat Martin wrote: 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

Re: [Tutor] Assigning a variable to an FTP directory listing

2013-12-11 Thread David
On 12 December 2013 10:55, Pat Martin wrote: > 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 sen

Re: [Tutor] Assigning a variable to an FTP directory listing

2013-12-11 Thread Steven D'Aprano
On Wed, Dec 11, 2013 at 03:55:50PM -0800, Pat Martin wrote: > 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 "22

[Tutor] Assigning a variable to an FTP directory listing

2013-12-11 Thread Pat Martin
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)