in reply to Changing file stats

Note that the ctime of a file can't be changed to anything other than the current time.

Dave.

Replies are listed 'Best First'.
Re^2: Changing file stats
by kyle (Abbot) on Feb 04, 2007 at 17:54 UTC

    Oops. I thought it said 'mtime' up there (rather than 'ctime', as I see now).

    I think that's OS-dependent, somewhat. On Mac OS X, I was able to change the mtime of a file. I wouldn't be surprised if some systems require administrative access (or just file ownership), but I haven't tested anywhere else.

    Update: I tried it on Debian GNU/Linux too, and it works the same way.

    $ touch testme $ ls -l testme -rw-r--r-- 1 kyle kyle 0 2007-02-04 13:12 testme $ perl -e 'utime time,1111111111,"testme";' $ ls -l testme -rw-r--r-- 1 kyle kyle 0 2005-03-17 19:58 testme $