-
CopyFileEx Fails to copy & deletes target file if source file is Open
I have written a little backup program. When a file is open it will not copy.
The CopyFileEx API Call Fails. I even used the COPY_FILE_OPEN_SOURCE_FOR_WRITE option.
If I open the file first using CreateFileA for GENERIC_READ
with Share Mode of:
FILE_SHARED_READ OR FILE_SHARED_WRITE,
and the CreationDisposition is: OPEN_EXISTING,
with attributes set to: FILE_ATTRIBUTE_NORMAL
Then the file opens successfully. Which I then close with CloseHandle.
But still when I try to use CopyFileEx it fails to copy the file.
What is even worse is that to old version of the file stored on the backup drive gets erased.
-
I'm not a real big fan of the FileSystemObject, but that will copy open files.
-
The problem with that is performance.
I went with the Windows API because of the performance benifits.
When you are backing up a lot of files every little bit helps.
Similar Threads
-
Replies: 7
Last Post: 10-18-2005, 05:14 PM
-
By Anonymous in forum Open Source
Replies: 0
Last Post: 05-25-2002, 01:53 AM
-
By Anonymous in forum Open Source
Replies: 0
Last Post: 05-12-2002, 09:05 PM
-
By Anonymous in forum Open Source
Replies: 0
Last Post: 04-24-2002, 01:20 AM
-
By Tomer Cagan in forum ASP.NET
Replies: 1
Last Post: 07-24-2001, 09:01 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|