I\'m trying to test a single file if it is open using lsof. Is there a faster way than this?
$result = exec(\'lsof | grep filename | wc -l\'); if($result &
Don't. The answer might change by the time you try to do anything with the result. Instead, try to do whatever you intended to do with the file and handle the "in use" error or "sharing violation".