I am learning some core Ruby (non Rails env) by playing with some File
i/o stuff and running under JRuby
How do I utime a Dir? - Dir doesn’t seem to have the method and
passing a dir to File.utime seems to just get ignored.
My script needs to compare the mtime of a file with a constant
offset. I ended up with this ugliness, turning both into Dates because
I couldn’t figure out how to turn a TWO_WEEKS_AGO into a Time! :
I am learning some core Ruby (non Rails env) by playing with some File
i/o stuff and running under JRuby
How do I utime a Dir? - Dir doesn’t seem to have the method and
passing a dir to File.utime seems to just get ignored.
File.utime works with C ruby and jruby 1.1 (I haven’t try 1.0)
Note: in jruby if the path is absolute “\temp” try with “c:\temp”
My script needs to compare the mtime of a file with a constant
offset. I ended up with this ugliness, turning both into Dates because
I couldn’t figure out how to turn a TWO_WEEKS_AGO into a Time! :
File.utime works with C ruby and jruby 1.1 (I haven’t try 1.0)
Note: in jruby if the path is absolute “\temp” try with “c:\temp”
Yea, quite right. My simple mistake was to issue a FileUtils.mkdir
after the utime on a subdir.
end
Any suggestions welcome.
DAY_DURATION = 246060
date = Time.now - 14*DAY_DURATION
Right, I get this but there is no way to convert a Date to a Time? I
guess I was looking for timeInMillis or something. Perhaps just need
to loose the Java head
DAY_DURATION = 246060
date = Time.now - 14*DAY_DURATION
Right, I get this but there is no way to convert a Date to a Time? I
guess I was looking for timeInMillis or something. Perhaps just need
to loose the Java head
Thanks.
timeInMillis would be stored in a fixnum. Hmm, let’s try .to_f .