可能重複:
How to get file creation & modification date/times in Python?Python:如何獲取文件夾的創建日期和時間?
我想獲得一個文件夾的創建日期和時間。有沒有辦法在Python中做到這一點?
謝謝
可能重複:
How to get file creation & modification date/times in Python?Python:如何獲取文件夾的創建日期和時間?
我想獲得一個文件夾的創建日期和時間。有沒有辦法在Python中做到這一點?
謝謝
您可以使用os.stat
檢索這些信息。
os.stat(path).st_mtime // time of most recent content modification,
os.stat(path).st_ctime // platform dependent; time of most recent metadata change on Unix, or the time of creation on Windows)
此問題已回答[此處](http://stackoverflow.com/questions/237079/how-to-get-file-creation-modification-date-times-in-python)。一探究竟 ;-)。 – OnesimusUnbound
謝謝你:--D – Ricky
還有一件事我想問一下,例如我在2011年的25.08.2011 01:58:00創建了一個名爲「file」的文件夾。當我將該文件夾複製到其他目錄時,其創建的日期和時間將發生變化。因此,即使將該文件夾複製到其他目錄,如何在25.08.2011 01:58:00獲取日期和時間。 :( – Ricky