in reply to Re: When is it safe to move a file?
in thread When is it safe to move a file?

Argh. Not that this is even important...it just got triggered by my comment I'm not sure how one loop runs stat() a million times though :)

You are completely right, it's wrong without the sleep(), and would most likely create problems. I've conceded that several times. Something I knew, but it slipped by.

What I was saying is that your earlier assertations:

weren't exactly correct.

Suppose that 5 minutes elapses between the file being written, and the invocation of the script. The loop drops out the first time.

So, the "minimum time" wasn't 300 seconds. I thought perhaps you were thinking that the rename() would change the mtime.

In any case, it was a glaring omission, and you were helpful in pointing it out.

Sorry for the confusion.

Whew.

  • Comment on Re: Re: When is it safe to move a file?