FileSystemObject

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the Scripting.FileSystemObject to copy files in a folder to
multiple folder locations using the .CopyFile methiod (no problem) .. then
attempting to delete the folder at the original location using the
..DeleteFolder method in the same procedure.

The files get copied to the specified location but errors when the
..DeleteFolder is tiggered in the code.
Am am receiving the error:

Run-time error '70'
Permission denied

I can check the folder and all files have been removed but the folder will
not delete ...

Is there any solution to get past this problem ???

R. Hicks
 
Two sources for that error, to my recollection:

(1) there is a file still in the folder. Delete all files from the folder.

(2) the application that is running the code has its current path
(directory) set to that folder. Change the current directory of the
application that is running the code and then delete the folder.
 
Thanks Ken ....
I searched my procedure and found where I referenced a value from the
FileSystemObject and assigned it to a string variable in the procedure ...
I only needed to set this variable to an empty string value before the
delete attempt .. and "all work fine" ...

Thanks for the quick response and the solution.
I will not quickly forget this as I have been fighing it all day.

R. Hicks
 
Back
Top