Re: Permission Denied when using File.Copy or fso.CopyFile
- From: usenet@xxxxxxxx
- Date: Thu, 05 Jul 2007 13:34:20 -0700
On Jul 4, 3:04 am, <mpic...@xxxxxxxxxxxxxxxx> wrote:
Hi,
If want to do this, you need to enumerate all your files and copy them one
at a time, otherwise (i.e. if you copy a folder) you cannot say what file
has problems. Moreover, if you check what files are open before starting
your copy, this state may change on the way and the check becomes unuseful.
Basically, you simply add an On Error Resume Next before starting copy. Then
check Err.Number after each file copy. If an error occurs, then add your
filename to an array for later retry. Reiterate through the array until all
files have been copyed (assuming that images are opened for a short time
window while user are browsing).
Hi Massimo,
Thanks for the response. I've set things up this way and so far, it
appears to be working smoothly. When a locked file is encountered, I
stuff the source and destination paths into an array (sourcePath & "|"
& destPath, so I can split on the pipe later). Once the initial run
completes, I return to my array and process those until none are left.
It's not the most elegant solution in the world but it's a nice hack
considering the lack of flock-ish behavior.
Again, my thanks!
.
- Follow-Ups:
- References:
- Permission Denied when using File.Copy or fso.CopyFile
- From: usenet
- Re: Permission Denied when using File.Copy or fso.CopyFile
- From: mpiceni
- Permission Denied when using File.Copy or fso.CopyFile
- Prev by Date: reading in functions but functions read won't execute!
- Next by Date: RecordSet to Excel file: how hard could it be
- Previous by thread: Re: Permission Denied when using File.Copy or fso.CopyFile
- Next by thread: Re: Permission Denied when using File.Copy or fso.CopyFile
- Index(es):
Relevant Pages
|