Hopefully someone on here can help me. I'm trying to use the FileSystemObject to delete any existing files from a predefined folder. I've looked in the archives and found related solutions but nothing quite like my problem. I've using the code listed at bottom but every time I run it I get the following error from my server:
Microsoft VBScript runtime error '800a0046'
Permission denied
/sorenwest_demo/admin_user.asp, line 446
I have checked the permissions on the server and they are as follows:
(Folder Level Settings in IIS)
SCRIPT SOURCE ACCESS
read checked
write checked
Scripts Only
DIRECTORY SECURITY
Anonymous Access
Account User for Anonymous Access - > IUSR_<computername>
Allow IIS to Control Password
I've played around with all these settings with no luck. Here is my script:
*********************
Case "delete"
'declare variables
Dim objFSO,objFolder,strPhysicalPath,strPath
Dim objCollection,objItem
'set the folder path (hard coded for now)
strPath = "./folders/folder8/"
'create the filesystemobject
strPhysicalPath = Server.MapPath (strPath)
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject"
Set objFolder = objFSO.GetFolder (strPhysicalPath)
'delete files in folder
Set objCollection = objFolder.Files
For Each objItem in objCollection
'the first line below works, the second produces a permissions error
response.write (objItem.name & "<BR>"
objItem.delete
Next
**************
Thanks in advance folks,
Carlos
Microsoft VBScript runtime error '800a0046'
Permission denied
/sorenwest_demo/admin_user.asp, line 446
I have checked the permissions on the server and they are as follows:
(Folder Level Settings in IIS)
SCRIPT SOURCE ACCESS
read checked
write checked
Scripts Only
DIRECTORY SECURITY
Anonymous Access
Account User for Anonymous Access - > IUSR_<computername>
Allow IIS to Control Password
I've played around with all these settings with no luck. Here is my script:
*********************
Case "delete"
'declare variables
Dim objFSO,objFolder,strPhysicalPath,strPath
Dim objCollection,objItem
'set the folder path (hard coded for now)
strPath = "./folders/folder8/"
'create the filesystemobject
strPhysicalPath = Server.MapPath (strPath)
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject"
Set objFolder = objFSO.GetFolder (strPhysicalPath)
'delete files in folder
Set objCollection = objFolder.Files
For Each objItem in objCollection
'the first line below works, the second produces a permissions error
response.write (objItem.name & "<BR>"
objItem.delete
Next
**************
Thanks in advance folks,
Carlos