How to get FTP file's modify time using Python ftplib

后端 未结 2 1737
北恋
北恋 2020-11-27 20:24

I\'m trying to load a CSV file to Amazon S3 with Python. I need to know CSV file\'s modification time. I\'m using ftplib to connect FTP with Python (2.7).

2条回答
  •  庸人自扰
    2020-11-27 20:52

    When I want to change the file modification time, I use an FTP client on the console. Log on to a remote FTP ftp ftp.dic.com

    • cd commands go to the correct directory
    • SITE command to move the extended command mode
    • UTIME somefile.txt 20050101123000 20050101123000 20050101123000 UTC

    change the access time, modification time, it's time to create a directory on 2005-01-01 12:30:00 somefile.txt

    Complete example:

    site UTIME somefile.txt 20150331122000 20150331122000 20150331122000 UTC

    Please feel free to sit back and wish you a pleasant journey in time :)

提交回复
热议问题