Python Forum
How can I get last modified time of a file in ftp? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: How can I get last modified time of a file in ftp? (/thread-11586.html)



How can I get last modified time of a file in ftp? - PrateekG - Jul-17-2018

Hi All,

There are some files put in a ftp location.
I am able to connect, see the files and download in local successfully with below code written in Python3.6-
import ftplib
server = ftplib.FTP()
server.connect('HOST', PORT)
server.login('USER_NAME','PASSWORD')
server.dir()
server.retrbinary("RETR " + 'xyz.csv' ,open('xyz.csv', 'wb').write)
server.quit()
I need to know the last modified time of a file in that ftp location so that if file is updated I can proceed with my other code.

But I am not able to find a way to achieve this.
Can anyone please help me how to do it?

Thanks!


RE: How can I get last modified time of a file in ftp? - wavic - Jul-18-2018

See this