Jan-25-2017, 01:58 PM
Hi,
I am new to python.....but have good Unix background.
I was trying to have ftp download a file from remote server to my local unix server.....
import ftplib
ftp = ftplib.FTP(some remote server)
ftp.login(uid,pass)
ftp.pwd()
ftp.cwd('/var/tmp')
ftp.dir()
ftp.retrlines('RETR somefile')
Now what is happening is, I am getting all the messages for dir listing, path etc... and finally am getting "226 file transfer successful".
But the directory where I ran the above code when checked, I didnt find the file downloaded there. Not sure what I have missed.
When I tried to check similar code on the net, found that some guys are opening a local file in write mode and downloading the contents of remote file in it. I find this unnecessary as why cant we just get the file in its entirety as we do in unix ftp session. Why should I be required to create a file at local server in write mode and then dump contents from remote file in it?
Please let me know if I have understood this correctly and please help.
Thanks,
PL
I am new to python.....but have good Unix background.
I was trying to have ftp download a file from remote server to my local unix server.....
import ftplib
ftp = ftplib.FTP(some remote server)
ftp.login(uid,pass)
ftp.pwd()
ftp.cwd('/var/tmp')
ftp.dir()
ftp.retrlines('RETR somefile')
Now what is happening is, I am getting all the messages for dir listing, path etc... and finally am getting "226 file transfer successful".
But the directory where I ran the above code when checked, I didnt find the file downloaded there. Not sure what I have missed.
When I tried to check similar code on the net, found that some guys are opening a local file in write mode and downloading the contents of remote file in it. I find this unnecessary as why cant we just get the file in its entirety as we do in unix ftp session. Why should I be required to create a file at local server in write mode and then dump contents from remote file in it?
Please let me know if I have understood this correctly and please help.
Thanks,
PL