On Fri, 2008-04-11 at 15:06 +1000, david wrote: > while inotifywait -e close somefile ; do > <lots of stuff> > rm foo/*.tif > done > > > The problem is that i need to make sure that foo/*.tif have closed > before I remove them, or strange things happen. > > I don't know what the names of the tif files are going to be, although I > know they will in directory foo/ > > Is there a way of waiting until all files in foo/ are closed?
lsof will work as long as foo/*.tif doesn't overflow your command line length. while inotifywait -e close somefile ; do <stuff> while lsof foo/*.tif > /dev/null 2>&1 ; do sleep 1 done done (usual disclaimer about actually testing this first applies) -- Pete -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html