954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to get the "last modified " date of a file or folder?

Is there a way to get the date a file or folder was last modified into python?

mahela007
Posting Whiz in Training
214 posts since Feb 2009
Reputation Points: 16
Solved Threads: 2
 

There certainly is a way!

import os

path = "path here"
seconds = os.path.getmtime(path)
print time.strftime('%Y-%m-%d %H:%M', time.localtime(seconds)
#it will output the time last modified!
Paul Thompson
Veteran Poster
1,119 posts since May 2008
Reputation Points: 264
Solved Threads: 183
 

It also needs

import time
wyt
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 1
 

thanks

mahela007
Posting Whiz in Training
214 posts since Feb 2009
Reputation Points: 16
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You