On most UNIXs fcntl and flock file locks are
advisory, not mandatory. So getting an
flock on a file is useless unless the other process is also using
flock. If locking is not being used by anyone then just you using it will have no effect.
BrowserUK's suggestions are the only ways I can think of, but won't be quick. Downside is that looking at which files are in use is not atomic, someone might grab or release a file in between you inspecting it and then carrying out an action.