Help on copy file

is it possible to copy a file which is newer than the existing one.
how can i check that?
Any Ideas.


Go read about the file class in ruby. FileUtils may give you a few
more options, but for this you don’t actually need it.

Use the stat method of an open file to get information about when it
was created, modified accessed, etc.

Here, I am getting the data on my file named “HP Laptop” where I’ve
got the chat log from the 6th time I had to send the damned thing back
to HP.“HP Laptop”)
=><File::Stat dev=0x802, ino=2680032, mode=0100644, nlink=1, uid=1000,
gid=1000, rdev=0x0, size=123838, blksize=4096, blocks=256, atime=Tue
Apr 28 11:18:19 -0500 2009, mtime=Fri Apr 24 13:49:05 -0500 2009,
ctime=Fri Apr 24 13:49:05 -0500 2009>
=>Fri Apr 24 13:49:05 -0500 2009
=>Fri Apr 24 13:49:05 -0500 2009
=> Tue Apr 28 11:18:19 -0500 2009

You can see I created the file on April 24th, and haven’t modified it
since. You also see it was last accessed on April 28th.

Now go dig into the File class, it has a move command, a copy command,
and all sorts of goodies that will help you do this for yourself, and
learn along the way.


Right, one more thing :slight_smile:
ctime is create time
mtime is modify time
atime is access time

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs