Skip to content

Instantly share code, notes, and snippets.

@nalsi
Created November 26, 2012 19:27
Show Gist options
  • Save nalsi/4150104 to your computer and use it in GitHub Desktop.
Save nalsi/4150104 to your computer and use it in GitHub Desktop.
Getting properties of all the files in a given folder
## Creator: Kai Li
## Time: 11/26/2012
## Task: Getting properties of all the files in a given folder.
import os
import os.path
import time
for f in os.listdir("c:\python27"):
print "File :", os.path.basename(f)
print "Access time :", time.ctime(os.path.getatime(f))
print "Modified time :", time.ctime(os.path.getmtime(f))
print "Change time :", time.ctime(os.path.getctime(f))
print "Size :", os.path.getsize(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment