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.


In reply to Re: Re: When is it safe to move a file? by kschwab
in thread When is it safe to move a file? by BoredByPolitics

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.