def get_ftpfile_lastmodified(self, file_path):
'''return lastmodified for a given file on ftp server.'''
try:
response = self.client.sendcmd('MDTM ' + file_path)
except error_perm as e:
self.logger.debug("Skip %s: %s" % (file_path,e))
return None
code, lastmodified = response.split()
# an example: 'last-modified': '20121128150000'
lastmodified = int(time.mktime(datetime.strptime(lastmodified, '%Y%m%d%H%M%S').timetuple()))
return lastmodified
评论列表
文章目录