changenotify - determine when a file has been closed.

S

Sean Nakasone

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.
 
T

Tim Pease

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top