Contribute  :  Calendar  :  Advanced Search  :  Site Statistics  :  Directory  :  Files to download  :  Links for developers  :  Privacy policy  :  Web Resources  :  Polls  
    MacOSX Guru Site Information, tips and tricks, FAQ for Mac OS X developers    
 Welcome to MacOSX Guru Site
 Wednesday, September 20 2017 @ 05:24 PM BST

How to find out when a file opened by another process was closed ?

   
Unix under OS X FAQIf we need to wait another process has finished working with a file, how can we be notified when the process closed the file ?

In Terminal, type
man lsof

lsof is installed in Mac OS X, but if you want to look at the source code, it's available here, also of interest see (topics 2.4 and 2.6)

Example of use:
we are waiting for MS-Word to close a file named Form.doc opened in the /tmp directory with:
lsof +D /tmp | grep Form.doc
As usual, such a command is easily "piped" or even executed from an AppleScript using do shell script.
 

What's Related

Story Options

How to find out when a file opened by another process was closed ? | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
 Copyright © 2017 MacOSX Guru Site
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.06 seconds