On Sun, Mar 20, 2011 at 7:12 PM, Christian Heimes <li...@cheimes.de> wrote:
> Am 21.03.2011 01:40, schrieb Dan Stromberg: > > 1) If you want to set the ctime to the current time, you can os.rename() > the > > file to some temporary name, and then quickly os.rename() it back. > > > > 2) You can sort of set a file to have an arbitrary ctime, by setting the > > system's clock to what you need, and then doing the rename thing above - > > then restore the clock back to what it should be. > > > > 3) You can also use some sort of tool that knows the details of how > inodes > > are stored on disk. You'll likely need to do this with the filesystem > > unmounted at the time, though if the inode isn't currently cached in RAM, > > you might be able to get away without the umount and mount. > > > > #2 and #3 require root access typically. > > You don't have to renmae the file to set the ctime to current time > stamp. os.chmod(), os.chown(), os.link() and possible other function set > the ctime of a file. Yes, I probably should've used a quantifier on my single example. > However ctime is *not* the creation time stamp on > POSIX OSes. > Well, it is, and it's not. It was originally called "creation time", but many today find "change time" a better description of what it actually does, sort of retroactively changing what the "c" means. This is because the ctime reflects the change time of an inode, not of the file's content - but most people don't really care what an inode is. Sometimes that's the same as the time at which the file was created, but it doesn't necessarily remain so throughout the file's lifetime.
-- http://mail.python.org/mailman/listinfo/python-list