Interesting question. I looked at this and on Windows, there appears to an "Oh" command!
http://windowsxp.mvps.org/processlock.htm
So you could get this "OH command!" (Open Handles) thing and find out who is currently using this file, then kill those processes and that will release the locks on the file and then you can delete that file! The idea is not to mess with the Windows file lock yourself, but use kill process to stop everybody who is using that file and then the file is not "locked".
Now if you can't easily restart these killed processes, etc. Then I would suspect that you should rename the file that is open to some other name. Copy in the new file. Then re-boot. Once a file is open, the name doesn't matter. The running processes continue to use the old file until re-boot or restart.
If this is a daemon (service in Windoze), then you can potentially restart the service..if it is "well-behaved", it will re-init with the new file and drop the old file. The old file is "deleted" with all processes using it have closed that file. Once a file is open, something like a file id, or node id is used, not the name. You can change the name without affecting any processes currently using the file.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.