Using process explorer from SysInternals, I found that the Vbscript
still has a file handle to tempFolderLocation. If I close the file
handle to tempFolderLocation manually just before FSO.DeleteFolder
executes, FSO.DeleteFolder runs fine without any error.
I am interested in finding out how I can close the handle to
tempFolderLocation before executing FSO.DeleteFolder.
Thanks in advance.
"IdleBrain" <indianmo...@yahoo.com> wrote in message
news:d57a1921-3b2e-4347...@x5g2000vbf.googlegroups.com...
Does the problem occur when you run this 2-line fragment of your code?
set fso=createobject("Scripting.FileSystemObject")
FSO.DeleteFolder tempFolderLocation, True
If it does not then the problem is caused by whatever code you excecute
before this fragment. You need to post it in order to get a good answer.
I am not running any particular code from within the
'tempFolderLocation' but I am running a batch file (.cmd) within that
folder using run(command) and waiting until the batch file is
completed.
Even a sleep of 30s does not help with not getting 'access denied'
error message.
"IdleBrain" <indianmo...@yahoo.com> wrote in message
news:f32c3b35-234d-42d0...@c11g2000vbe.googlegroups.com...
Your answer is a little ambiguous and we need to be very precise here. The
questions is: Does the problem occur when you run this 2-line fragment of
your code?
set fso=createobject("Scripting.FileSystemObject")
FSO.DeleteFolder tempFolderLocation, True
In other words, does it occur when you paste these two lines into a .vbs
file, replace tempFolderLocation with an actual string, then invoke the
script?
"IdleBrain" <indianmo...@yahoo.com> wrote in message
news:b44fc9b3-cca1-4178...@y36g2000yqm.googlegroups.com...
This is what I suspected. Your problem is caused by one of the following:
a) The code that you do not show us opens the folder you wish to delete, or
a file inside this folder.
b) Your current working directory is the folder you wish to delete.
It is impossible to say which one it is unless you post the full VB Script
code and how exactly you invoke it.
Appreciate your help and hats off for your insight into the problem.