Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission Denied When Delete Folder

Status
Not open for further replies.

beer

Programmer
Mar 13, 2001
19
US
Hello,

I am building a web site on a NT4.0 Service Pack 6.0a IIS 4.0 Server. One of the pages has the function to delete folder and file. I was randomly getting the "Permission Denied" error when I tried to delete a folder that had files in it. Then, I figured out that the error only happened after a file was viewed. For some reason, the system thinks that the file is still open and that cannot be deleted or the file is still in the middle of deleting while the code tries to delete the folder.

I tried everything to solve this problem in my coding, but it seems that the problem is not coming from the code. It's the system. Does anyone know how to solve this problem? Your help is extremly important. Thank you very very very much.

Beer....
 
Buffer? How and where? Response.Buffer = True? I did the Response.Buffer = True.

Thank you.
 
No luck.....Thank you for your help.....

Beer
 
The following is my code:

***************************************
If fso.FolderExists(FolderPath) = True Then
fso.DeleteFolder FolderPath, True ------PROBLEM
End If
***************************************

The "Permission Denied" is coming from the line "PROBLEM" I have tried to delete the files first and then delete folder:

***************************************
If fso.FolderExists(FolderPath) = True Then
Set Folder = fso.GetFolder (FolderPath)
Set Files = Folder.Files
For each File in Files
fso.DeleteFile File, True
Next
fso.DeleteFolder FolderPath, True----------PROBLEM
End If
***************************************

Still no luck. When I actually go to the folder, and I can still see the files inside that folder. But after a while, the files disappear as they are deleted. That's why I think it's because for some reason, the system is still deleting the file while the delete folder code comes in and it returns "Permission denied".

Thank you for your help.

Beer
 
If thats what you think your problem is, then you could put a loop around the DeleteFolder part, that just checks the file count for the folder. When the file count = 0, delete folder. Brett Birkett B.Comp
Systems Analyst
 
Thank you very much for your help. It worked. But the process of deleting the files take a while to finish. It's very weird how NT 4 and IIS 4.0 do that. But if anyone can think of something else, please do tell.

Thank you very much.

Beer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top