Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
No such thing as a small change
 
PerlMonks  

Re: File::Copy - locked files

by ww (Bishop)
on Feb 11, 2013 at 17:11 UTC ( #1018189=note: print w/ replies, xml ) Need Help??


in reply to File::Copy - locked files

Not a good idea!

Wait for the lock to be released. Otherwise you may be putting an incomplete or outdated file into your backup collection. As with all backups, shortcomings don't usually get to be a big problem... until you actually need the backup, by which time, it's too late to fix the problem.


If you didn't program it by toggling in binary, it wasn't programming!


Comment on Re: File::Copy - locked files
Re^2: File::Copy - locked files
by packetstormer (Monk) on Feb 11, 2013 at 18:12 UTC

    Agreed!

    What about files that are in use though, continually (or close to). Is there any accepted method for dealing with this type of thing? Suppose it's a small Access database with a lock on it (in use by a Windows service that is always running!). Is there any shadowing copying libraries for Perl!?

      Recent Windows versions have a special service (Volume Shadow Service? Use Google!) for this problems, it allows you to take some kind of snapshot of the filesystem. All modifications after the snapshot do not affect your program, so you can safely copy files from a mounted filesystem. Of course, this service can't guarantee that all open files are in a consistent state.

      Regarding your locked Access database: Shut down the service, then backup or make at least a copy of the database file, then restart the service and exclude the original, locked file.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

        Regarding your locked Access database: Shut down the service, then backup or make at least a copy of the database file, then restart the service and exclude the original, locked file.

        Seems crude :) i'll bet there is a way without shutting down the service

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018189]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-04-18 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (462 votes), past polls