0
我可以打印文件的mtime屬性。我只關心在最後xxxx分鐘內修改過的文件。我觸摸了目錄中的文件,所以我知道那裏有新文件。如果文件mtime小於x數量。打印這些文件
file_list_attr = sftp.listdir_attr('/path')
fdir = sftp.listdir(path=source)
for f in file_list_attr:
print "name=%s, modified date=%s, size=%s" % (f.filename, f.st_mtime,f.st_size)
mt = f.st_mtime
now=dt.datetime.now()
while f.st_mtime == now-dt.timedelta(minutes=2120):
print 'You have something here'
else:
print 'nada'
Poggi,我會試試看。感謝您幫助新手 – user1086526 2012-03-04 14:50:36
這個問題似乎是,日期時間現在不能遍歷整數。 TypeError:無法將datetime.datetime與int相比較 – user1086526 2012-03-04 23:55:27