Thanks for your replies.

Sorry I wasn't clear about the purpose. It's just a hobby and I'm trying to learn and solve the puzzle. There's probably alsorts of bad in this, but here goes...

Wife has a USB stick with her work on, and she gets files from co-workers. They need backing up to the cloud in case of loss/forgeting stick. So, I have rsync running on a crontab that copies her USB stick contents into OneDrive. All works well until someone puts an illegal filename into the mix. I don't get to use her computer much 'cos she's nearly always using it. So I want to run a script as a crontab to clean up any issues and stop things from jamming up.

If she's got a file open in MS Word, I don't want it renamed, like it does at present. So I'm wanting to check for file handles in the tree whilst it's being used. When she closes the file, the script will run again at some point and take care of the issues.

Thanks again, and I hope that makes it a bit clearer.


In reply to Re: Easy way to check if a file is open needed. by Apt_Addiction
in thread Easy way to check if a file is open needed. by Apt_Addiction

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.