in reply to Re: Re-Creating a file does not change inode modification time (Windows)
in thread Re-Creating a file does not change inode modification time (Windows)
I think I got a case where I can reproduce this strange behaviour. At least I could provoke it several times repeatedly. Here is an example from the Windows command line (I'm using the DEL command to erase the file instead Perl's unlink; "ls" is the GnuUtil's ls.exe):
We can see that the ctime did not change, although I erased pid.txt and created a new version! Now for a new experiment:C:\>ls -l pid.txt -rw-rw-rw- 1 user group 4 Sep 15 16:51 pid.txt C:\>type pid.txt 8748 C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Thu Sep 15 16:45:56 2011 C:\>del pid.txt C:\>echo 8748 >pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Thu Sep 15 16:45:56 2011
First, I moved the old pid.txt away; then a created a new one. I still get the old time stamp!!! But now look at this:C:\>move pid.txt pid.old 1 file(s) moved. C:\>echo 8749 >pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Thu Sep 15 16:45:56 2011
I delete the file, as in the very first example before. Then I run my perl command to display the ctime of the non-existing file. Not surprisingly, I get an error message. Now I re-create pid.txt and get the ctime. THIS TIME the ctime is up-to-date!!!!C:\>del pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" Use of uninitialized value in localtime at -e line 1. :Thu Jan 1 01:00:00 1970 C:\>echo 8750 >pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Tue Sep 20 11:30:49 2011
The last (third) example differs from the first one only in that I asked Windows for the ctime of the *deleted* pid.txt. This seemed to "erase" the old timestamp somehow!
This doesn't look to me like a Perl problem anymore. It seems to be a pure Windows problem. My apologies for having it posted here...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Re-Creating a file does not change inode modification time (Windows)
by BrowserUk (Patriarch) on Sep 20, 2011 at 13:53 UTC | |
by Anonymous Monk on May 07, 2014 at 16:04 UTC | |
by rovf (Priest) on Sep 20, 2011 at 15:52 UTC |