Is there a way to determine when a file has been closed? I know the
changenotify module can determine when a file is written to, but I need
to
know when it has been closed. The file is a postscript file being
created
by a printer driver and I want to make a copy of it when the file is
done
being written to.
On Apr 18, 2008, at 7:25 PM, Sean N. wrote:
Is there a way to determine when a file has been closed? I know the
changenotify module can determine when a file is written to, but I
need to know when it has been closed. The file is a postscript file
being created by a printer driver and I want to make a copy of it
when the file is done being written to.
A quick way to do this would be the directory_watcher gem. It watches
files in a directory and notifies you when those files change – add,
modified, deleted. There is a fourth file notification event called
“stable” – this is sent when the file has remained un-modified for X
amount of time.
http://codeforpeople.rubyforge.org/directory_watcher/
It’s all ruby code, so it should work on Windows and Unix equally well.
Blessings,
TwP