[CMI.PM] Mongers - need to pick your brains

Bob Kuo bobjkuo at gmail.com
Fri Aug 24 08:21:28 PDT 2012


Looks like this stack overflow post might be perfect:

http://stackoverflow.com/questions/3220206/determine-whether-a-file-is-in-use-in-perl-on-windows

There might be a nicer way if your machine has powershell which would
allow you to directly call Windows APIs.

b

On Fri, Aug 24, 2012 at 10:00 AM, Price, Bob <BPrice at atgf.com> wrote:
> I’m looking for a way to find out on a windoze platform whether or not a file is open by another process or user.
>
> Scenario:
>
> I have a process that copies files from one location to another, and deletes the original file upon successful copy. The problem arises when a user is holding that file open in another program (i.e. open in acrobat, still being written, etc.), and I don’t want to loop back and copy the file again. I would rather be able to determine that the file is in use, and just skip on to the next file, coming back later to check on the file and process it when it is no longer in use.
>
> Any experience with this?
>
> _______________________________________________
> Champaign-Urbana mailing list
> Champaign-Urbana at pm.org
> http://mail.pm.org/mailman/listinfo/champaign-urbana


More information about the Champaign-Urbana mailing list