explodec14 has asked for the wisdom of the Perl Monks concerning the following question:

Hello to all - I would like to know how do I lock a directory. I need to copy very large amount of files to a certain directory. I would like to have an exclusive lock on the destination directory so I would be able to copy the files without any interferences from other processes. Is it possible to do? I have been messing around with it for a quite deal of time. Any help will be appreciated. 10x

Replies are listed 'Best First'.
Re: Directory flock/Directory locking
by cdarke (Prior) on Dec 07, 2009 at 11:46 UTC
    Use file permissions. Login to the owner of the directory and remove permissions for any other user or group. Do your stuff, then reset the permissions on the directory.
      thank you indeed. that's what i have done eventually
Re: Directory flock/Directory locking
by Anonymous Monk on Dec 07, 2009 at 10:03 UTC
    use File::Temp to create a temorary directory, copy files into it, when you're done, rename from temporary name to final name.
Re: Directory flock/Directory locking
by stefbv (Priest) on Dec 07, 2009 at 11:44 UTC
    Perl Cookbook has a recipe that may be what you need. (7.24 Program: netlock)