<p><br>
On Jul 30, 2013 3:29 PM, "Chris Angelico" <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br>
><br>
> On Tue, Jul 30, 2013 at 2:10 PM, Tim <<a href="mailto:jtim.arnold@gmail.com">jtim.arnold@gmail.com</a>> wrote:<br>
> > hmm, now that you mention it, this is executing on a remote box with access to the same file system my local calling program is on. That is, there is a local call to an intermediate script that connects to a socket on the remote where the above program actually runs, but the file system is the same place for both local and remote.<br>
> ><br>
> > But even so, since the script that does the rmtree and mkdir is running on the same machine (even though it's remote), I would think the mkdir couldn't execute until the rmtree was completely finished.<br>
><br>
> Hmm. What system is used for the file system sharing? I know quite a<br>
> few of them lie about whether something's been completely done or not.<br>
><br>
> Can you use inotify to tell you when the directory's been deleted?<br>
> Seems stupid though.</p>
<p>Inotify is a linux thing, but there is kqueue for Free?BSD. OP can run the deletion procedure, wait for a NOTE_DELETE event, which would block, and create the fresh directory afterwards. It may require some C hacking though, in case Python lacks a kqueue wrapper. I think that this kind of approach would be more sound than a check-wait-loop approach.</p>
<p>(I would elaborate more with pointers to appropriate documentation, but I'm on a silly tablet, please excuse me for that.)</p>
<p>-gk</p>