Re: FileCopy vs. Read & Write or CopyFile API
- From: Sinna <news4sinna_NOSPAM@xxxxxxxxxx>
- Date: Fri, 16 Nov 2007 08:36:35 +0100
Jialiang Ge [MSFT] wrote:
Hello Peter,<snip>
From your post, my understanding on this issue is: you wonder how to synchronize a document in server to its client with VB FileCopy function. If I'm off base, please feel free to let me know.
Generally speaking, VB function FileCopy fails and pop out "Permission denied" exception when we attempt to copy a file that is opened or when the destination file cannot be overwritten. Please check if the document in the server is opened, and if the destination in client can be overwritten.
<snip>
Another approach is to use FileSystemObject (http://msdn2.microsoft.com/en-us/library/2z9ffy99.aspx) , which can copy a locked file:
Set fs = CreateObject("Scripting.FileSystemObject")
fs.copyfile "server file", "client file"
It copies the last save of the file.
Please have a try and let me know the result.
Your suggestion about using the FileSystemObject is quite interesting. Where did your read that it also can copy locked files?
Personally I hate the FSO (as it contains some nasty bugs and it results in another - for me useless - dependency) but if you can put me in the right direction, I'll consider it again.
Probably it's also possible using the Win32 API's (as FSO is a wrapper around it). I hope the source you've used to state this mentions it.
Sinna
.
- Follow-Ups:
- Re: FileCopy vs. Read & Write or CopyFile API
- From: Jialiang Ge [MSFT]
- Re: FileCopy vs. Read & Write or CopyFile API
- References:
- RE: FileCopy vs. Read & Write or CopyFile API
- From: Jialiang Ge [MSFT]
- RE: FileCopy vs. Read & Write or CopyFile API
- Prev by Date: Re: Trouble moving or resizing objects
- Next by Date: Re: Best UI for VB6
- Previous by thread: Re: FileCopy vs. Read & Write or CopyFile API
- Next by thread: Re: FileCopy vs. Read & Write or CopyFile API
- Index(es):
Relevant Pages
|