python: ftp get directory creation date
I want to connect to my ftp server where directorys like "01-26-2011" are created on a daily basis (no specific pattern, "Jan2011-26" is also a possible directory name). Inside this directory are again some directories. I want to write a script that check开发者_StackOverflows every 10 minutes if a new directory is created. So my question is: How can I get/read the ftp directory creation date? What would be the best way (efficient way) to check them?
If I would have like 1000 directories on my ftp root (I mean: Jan2011-26, Jan2011-25, Jan2011-24, Jan2011-23, Jan2011-22 and so on...) is would be bad to check every single folder (I don't even want that). It's fine if the script only checks the last 5 directories (so only Jan2011-26, Jan2011-25, Jan2011-24, Jan2011-23, Jan2011-22), but it has to check if any new directory is created in these 5 folders. How can I do that? Thanks!
Depending on the details you need, you can use FTPLIB To list the directories listing. You could do something like save them to a list and compare in 10 min the 2 sorted lists. You can also digg deeper and search in FTPLIB for any attributes. I don't know much FTPLIB, but here a solution.
精彩评论