[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

stamping my own timestamp

Peter Bailey

7/16/2007 12:33:00 PM

Is there a way to "touch" a file with a time stamp of my own choosing,
in other words, not the "now" time? I've got a bunch of files that have
been inadvertently "touched" time-wise, and I need them to have truer
time stamps, from a month or so ago.

Thanks,
Peter

--
Posted via http://www.ruby-....

5 Answers

Robert Klemme

7/16/2007 12:49:00 PM

0

2007/7/16, Peter Bailey <pbailey@bna.com>:
> Is there a way to "touch" a file with a time stamp of my own choosing,
> in other words, not the "now" time? I've got a bunch of files that have
> been inadvertently "touched" time-wise, and I need them to have truer
> time stamps, from a month or so ago.

http://www.ruby-doc.org/core/classes/FileUtils.ht...

e.g. FileUtils.touch("foo", :mtime => Time.now)

robert

Peter Bailey

7/16/2007 1:26:00 PM

0

Robert Klemme wrote:
> 2007/7/16, Peter Bailey <pbailey@bna.com>:
>> Is there a way to "touch" a file with a time stamp of my own choosing,
>> in other words, not the "now" time? I've got a bunch of files that have
>> been inadvertently "touched" time-wise, and I need them to have truer
>> time stamps, from a month or so ago.
>
> http://www.ruby-doc.org/core/classes/FileUtils.ht...
>
> e.g. FileUtils.touch("foo", :mtime => Time.now)
>
> robert

Thanks. But, this is what I get when I try that. Doesn't the "Time.now"
give it the time of right now?

irb(main):003:0> FileUtils.touch(file, :mtime => Time.now)
ArgumentError: no such option: mtime
from c:/ruby/lib/ruby/1.8/FileUtils.rb:1424:in
`fu_check_options'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:1009:in `touch'
from (irb):3

--
Posted via http://www.ruby-....

Robert Klemme

7/16/2007 1:53:00 PM

0

2007/7/16, Peter Bailey <pbailey@bna.com>:
> Robert Klemme wrote:
> > 2007/7/16, Peter Bailey <pbailey@bna.com>:
> >> Is there a way to "touch" a file with a time stamp of my own choosing,
> >> in other words, not the "now" time? I've got a bunch of files that have
> >> been inadvertently "touched" time-wise, and I need them to have truer
> >> time stamps, from a month or so ago.
> >
> > http://www.ruby-doc.org/core/classes/FileUtils.ht...
> >
> > e.g. FileUtils.touch("foo", :mtime => Time.now)
> >
> > robert
>
> Thanks. But, this is what I get when I try that. Doesn't the "Time.now"
> give it the time of right now?
>
> irb(main):003:0> FileUtils.touch(file, :mtime => Time.now)
> ArgumentError: no such option: mtime
> from c:/ruby/lib/ruby/1.8/FileUtils.rb:1424:in
> `fu_check_options'
> from c:/ruby/lib/ruby/1.8/FileUtils.rb:1009:in `touch'
> from (irb):3

Works for me:

irb(main):003:0> FileUtils.touch "f", :mtime => Time.now
=> ["f"]
irb(main):004:0> RUBY_VERSION
=> "1.8.6"
irb(main):005:0> File.mtime "f"
=> Mon Jul 16 15:52:06 +0200 2007

Alternatively you can try to use File.utime().

Kind regards

robert

--
Have a look: http://www.flickr.com/photos/fu...

Peter Bailey

7/16/2007 2:06:00 PM

0

Robert Klemme wrote:
> 2007/7/16, Peter Bailey <pbailey@bna.com>:
>> >
>> from (irb):3
> Works for me:
>
> irb(main):003:0> FileUtils.touch "f", :mtime => Time.now
> => ["f"]
> irb(main):004:0> RUBY_VERSION
> => "1.8.6"
> irb(main):005:0> File.mtime "f"
> => Mon Jul 16 15:52:06 +0200 2007
>
> Alternatively you can try to use File.utime().
>
> Kind regards
>
> robert

Thanks, Robert. That particular thing just doesn't work for me, but, I'm
intrigued by File.utime. I read about it a bit and I think it might do
the trick. Thanks a lot!

--
Posted via http://www.ruby-....

The Peeler

12/8/2010 8:47:00 PM

0

On Wed, 8 Dec 2010 20:25:13 +0000 (UTC), RJ11 <rj11@nospam.com> wrote:

>In article <w7QLo.28137$3X4.26748@newsfe06.ams2>,
>Mrcheerful <nbkm57@hotmail.co.uk> wrote:
>
>> there were only about 3million there to start with
>
> No. 3.3 million in Poland, 800,000 in Hungary, well over
>a million in the areas of the USSR occupied by the Nazis, and
>more in all the other European countries.

Lies, more lies and yet more jew lies.

>> and many of them left.
>
> Where to?

Palestine, Argentina, Brazil, the US, Canada, all over the goddam
world.