FileSystemObject DeleteFolder Permission Denied

K

Katja

Dear all,

I have a script that creates a FileSystemObject to be used for
folder/directory manipulation. What I am trying to do is to search the
drive if folder exist. If it doesn't it creates a new folder, but if
the folder exists it deletes the old folder and creates a new one. The
error refers to the line where I am deleting the folder. Here is my
code:

zip_path = "C:\cd_build"

If fso.FolderExists (zip_path & "\to_Zip") Then
error line -> fso.DeleteFolder (zip_path & "\to_Zip" )
fso.CreateFolder (zip_path & "\to_Zip" )
else
fso.CreateFolder (zip_path & "\to_Zip" )
end if

And this is the error I am getting:

Microsoft VBScript runtime error '800a0046'

Permission denied

I have all the rights (full control) to the folder.

If I am trying to delete the folder in the Windows Explorer it gives
me and error for Sharing Violation. This foder is not used by any
other program, open anywhere else or anything.
I have no idea what is going on!!

Please somebody help me.

Thanks
Katja
 
R

Ray at

Is this folder shared?

Ray at work

Katja said:
zip_path = "C:\cd_build"

If fso.FolderExists (zip_path & "\to_Zip") Then
error line -> fso.DeleteFolder (zip_path & "\to_Zip" )
 
K

Katja

Hi Ray,
Yep, the folder is shared.
I tried to close the sessions and stuff as if it was thinking that the
folder was in use but still no joy.
Any other thoughts?

Katja
 
R

Ray at

Delete the share?

Ray at work


Katja said:
Hi Ray,
Yep, the folder is shared.
I tried to close the sessions and stuff as if it was thinking that the
folder was in use but still no joy.
Any other thoughts?

Katja

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
 
K

Katja

Hi Ray,
Thanks for your reply but it didn't work either. The folder needs to
be shared so that user has read and write access to it.
I think the system somehow thinks that the folder is in use even it is
not.
The user did download the content of the folder just few secs earlier
so maybe there is a way to tell it that it has finished downloading
and then it would allow it to be deleted.

Any thoughts?

Thanks,
Katja
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top