Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21843

Error 70 (permssion) during FileSystemObject operation

$
0
0
Hello

I am trying to copy my Document folder complete with subdirectories and all files in the root and them to another (backup) drive.

First I tick the Microsoft Scripting Runtime in the IDE at Project/References.

A portion of the code then is

Code:

    aSourcePath = "C:\Users\Alan\Documents\*.*" 'source + wildcard (for scripting)
    aDestinationPath = aDestinationDrive & "\My Docs backup\" ' selected backup drive + dir
...

  Dim fso As New FileSystemObject
    Set fso = CreateObject("Scripting.FileSystemObject")
  fso.CopyFolder aSourcePath, aDestinationPath, True

When I run this, after a while (in which it is apparent that at least some of the subdirectories and their files are being copied) the process halts with Runtime Error 70 (permission denied). I would think that one (or more files) in my Documents file has insufficient permission to be copied.

1) What I'd like to is either

a) Find the name of the file concerned and manually change the permission

or

b) Ignore the permission limitation and copy anyway

or

c) (as a very last resort as I want my backup to be complete) jump over the file (and any others with similar limitations.

2) If possible, I'd quite like to display the actual filenames in listbox while being copied but can't see how to do that in the recursive code (I can do it fine when just copying files in the root directory and not using FileSystemObject.

Thanks

Viewing all articles
Browse latest Browse all 21843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>