Re: Permission Denied when using File.Copy or fso.CopyFile



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!

.



Relevant Pages

  • Re: Recursivly deleting a list of files
    ... But I still need to figure out the array. ... ts.writeline oFile & " " ... 'Print subfolders of the current folder ... >> dim fldrsFolderlist, fldr ...
    (microsoft.public.scripting.vbscript)
  • Classes and Arrays
    ... have created a class called "record" to store information about a folder and ... The Perms property is a dynamic array as per ... Each element in the Perms array should be another class called PermRec. ... Private Sub Class_Initialize ...
    (microsoft.public.scripting.vbscript)
  • Re: Can you fix this program? : C++ Dynamic Array Problems
    ... Dynamic Array similar to System.Collections.ArrayList in .NET. ... Capacity = 0; ... void FoldersCollection::Add(Folder folder) ... int newCapacity = Capacity*2; ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Nested Sets vs. Nested Intervals
    ... but it would be more convenient for the user to retrieve its ... children from an array of folder names in the URL (seperated by dots or ... Both dmoz and yahoo also retrieves its immediate subcategories by the ... it's like replicating a file system: an array of folder ...
    (comp.databases.theory)
  • need help managing volume size
    ... I use an array for automated daily backup, ... I have set up three folders on the array A,B, C. ... I also wish to keep the size of each folder at a certain level. ... I also think gdelinda has a memory leak because the file sizes and ...
    (microsoft.public.windowsxp.basics)

Quantcast