Hi all,

Is there a way, once a file has been opened, to determine whether it's 
been deleted versus moved?

More of an OS question I suppose, but...

For example, using a file called "temp" with a single line "Hello 
World!" in it, let's say I do this.

f = File.open("temp","r")

while true
   # What should the test be?
   puts f.gets
   f.rewind
end

As is, this program will continue to function if "temp" is moved to, 
say, temp1.  The filehandle then reads from temp1.  But, how do I detect 
that the file which the filehandle is attached to no longer exists?

The trick is, in the while loop above, I can't simply use an 'exist?' 
test, because that wants a filename, and "temp" no longer exists (it's 
now temp1).

I tried using stat.inode, thinking the inode would be set to nil if the 
file that the filehandle was attached to was deleted, but that doesn't 
seem to be the case.

Any ideas?

Sincerely,

Daniel Berger