0

I am trying to copy files automatically from one computer to another over a network.

Only problem now is locked files. I cannot seem to be able to copy locked files like for example outlook.pst, when i try to do anything with it while outlook is running i get an access denied error due to it being used by outlook.

is there anyway to copy this file still?

i have tried the CopyFile and TStreamcopy functions but no success, the article below has an answer marked as correct, but i cannot seem to get the solution to work.

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20950232.html

Any help would be greatly appreciated

Thank you

user3510818
  • 103
  • 1
  • 12
  • You are facing the problems that a backup agent faces. Not easy to solve. Usually this requires kernel mode drivers to get right. – David Heffernan May 28 '14 at 11:25
  • Ok, is there a solution that you know off? @davidheffernan – user3510818 May 28 '14 at 11:57
  • The article you link to makes no attempt to deal with the file being locked. You are not going to get a simple solution to this problem. Do you appreciate the challenge that you have set yourself? The application locked the file to stop you reading it. And it did so for a reason. Presumably you've done a websearch: http://www.google.com/search?q=copy+file+that+is+locked – David Heffernan May 28 '14 at 12:01
  • 2
    You don't necessarily *want* those files anyway. They're locked for a reason. Whatever image you get of the file is liable to be in an inconsistent state and unusable afterward. – Rob Kennedy May 28 '14 at 12:06
  • @davidheffernan i understand the challenge, if it was easy there would be 100 links on the internet explaining how to do it. But i need to be able to backup outlook files. and i cannot do it if they are locked. – user3510818 May 28 '14 at 12:19
  • @Robkennedy I do need those files, outlook runs 24/7. so the files are never "not locked" so i need to be able to copy them while outlook is running. – user3510818 May 28 '14 at 12:20
  • @user3510818 Sounds like you know more about your problem than any of us do. I hope somebody comes along to help you that knows better than Rob and I. – David Heffernan May 28 '14 at 12:21
  • 1
    @davidheffernan I'm sorry, did that come across as rude? If so i apologize. I'm only trying to explain i know the difficulty of the task. But that it is a necessary task. – user3510818 May 28 '14 at 12:27
  • You could use the Volume Shadow Copy service. That's one of the techniques my company's backup program uses. But again, that still doesn't guarantee the file is usable afterward unless the file's program is aware of snapshot services. Exchange Server supports that, for example, but Outlook doesn't. – Rob Kennedy May 28 '14 at 12:34
  • Since you don't want to heed any of the advice you have been offered, I can only conclude that you are more knowledgeable than me in this area. Certainly very plausible. I'm sure somebody who knows more will help you. – David Heffernan May 28 '14 at 12:37
  • @RobKennedy thank you. Now we are getting somewhere. How do i go about implementing this in delphi? Are there links or anything you may be able to provide? – user3510818 May 28 '14 at 12:42
  • Wikipedia has an overview, and it links to the API documentation. – Rob Kennedy May 28 '14 at 12:52
  • 1
    *Now we are getting somewhere*. If you'd only followed the websearch link I gave you you would have discovered VSS! It doesn't seem as though you have worked terribly hard at researching this. It also seems a little odd that you want to ignore what Rob says about the shadowed .pst file potentially being useless. – David Heffernan May 28 '14 at 12:57

0 Answers0