Would [os.stat](http://docs.python.org/2/library/os.html#os.stat) not be a little simpler here? If this process is better for some reason it would be useful to add a comment describing that.