Check File Change Every 10 Seconds

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Oct 22 11:50:12 EDT 2007


En Mon, 22 Oct 2007 11:45:49 -0300, Robert Rawlins - Think Blue  
<robert.rawlins at thinkbluemedia.co.uk> escribi�:

> Thanks for your time Gabriel,
>
> That certainly looks to be the type of thing that I'm looking to  
> achieve, however, I forgot to mention I'm running this on a Linux  
> platform and not a Win32 one :-( Sorry.

Ouch! Should have asked...

> I'm sure similar things are achievable, I've used os.stat before now to  
> get the time stamp for when a file was last changed, if I perhaps  
> combine this with the while 1: inside a thread I can achieve the same  
> end result? Sound like a good idea?

Yes, that may work, but there are better ways I think. Check this recipe  
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/217829> and the  
pyinotify module at sourceforge.

-- 
Gabriel Genellina




More information about the Python-list mailing list