The traditional Unix utilities to solve this problem are "lsof" and 
"fuser". I don't know if OSX has either of these as standard, but they 
are probably available as ports.

Locking won't help unless the other process has taken a lock on the 
file.
-- 
Posted via http://www.ruby-forum.com/.