From: Michael Kircher Date: 2002-04-23T05:33:47+09:00 Subject: Re: Modified date due to File.copy Hi Ned Thanks for the reply. Are you sure it works on Win XP? I get the error: in `utime': Invalid argument - "foo.pdf"(Errno::EINVAL) even though the file exists and is not protected by any means. Thanks, Michael Ned Konz wrote: > Michael Kircher wrote: > > > I am developing an application where I have to rely on the > > date of files. If I do copy files, I expect to have the "last modified > > date" to stay the same on the copy. > > > Is there any way to avoid this? The call to system ("copy", ...) > > did not succeed but returned false - is that supposed to work? > > $ ri utime > ------------------------------------------------------------ File::utime > File.utime( anAccessTime, aModTime [, fileName]+> ) -> aFixnum > ------------------------------------------------------------------------ > Changes the access and modification times on a number of files. The > times must be instances of class Time or integers representing the > number of seconds since epoch. Returns the number of files > processed. Not available on all platforms. > File.utime(0, 0, "testfile") #=> 1 > File.mtime("testfile") #=> Wed Dec 31 18:00:00 CST > 1969 > File.utime(0, Time.now, "testfile") #=> 1 > File.mtime("testfile") #=> Sun Mar 04 23:28:25 CST > 2001