I'm not sure I understand the question. It sounds like you already know how many files should be in the directory in order for it to be "done being written", and you seem to also know the intended "full size" of the files. Where does this information come from? Where do the files come from?

How are you able to tell that -s or stat() on a large file "just reports the full size before it's all there"?

Are you able to configure or monitor the source (or the process) that is putting files into the directory? If so, you could set it up to issue some unambiguous event when it's done (e.g. create a special little file), or just check whether it's still running.

If you don't have that sort of access to the source, well, it depends. If the receiving directory were on a unix/linux machine, the -s or stat() would report how much data has been stored so far, and your loop approach would work as expected. Oh well.

Isn't it the case that windows prohibits certain kinds of access to a file when some process is writing to that file? If that happens to be true in your case, maybe you can figure out some harmless operation that will fail while the file is being written, succeed only when the writing process has finished and closed the file, and in any case does not change the file content. Good luck with that.


In reply to Re: When file is committed to disk? by graff
in thread When file is committed to disk? by noslenj123

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.