From: Paul Archer Date: 2009-07-17T05:48:46+09:00 Subject: Re: making sure a file isn't being written/copied before moving Tomorrow, Brian Candler wrote: > Paul Archer wrote: >> Can someone suggest an easy (or at least reliable) way to make sure >> that >> any file I'm about to modify isn't being touched by another program? > > As you said yourself: rely on the atomic semantics of the filesystem. > Rename it to an extension which the other program will not recognise, or > into another directory which the other program won't be looking in. > Perhaps you missed it in my original post (or perhaps I simply wasn't clear), but I may be operating on files that are added arbitrarily. My concern is that the script starts acting on a file that is still being copied. Renaming it won't help there. Paul