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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission Denied error using FSO

Status
Not open for further replies.

cinnamoneast

Programmer
Oct 8, 2002
5
US
I am using the FileSystemObject to delete a file from the server. I keep getting the "permission denied" error. I have checked the security on the folder and the IUSER account has full control. Also I have IIS set to use IUSER account with password syncronization. I have tried it on several computers and get the same error so I figure I have to be missing something. Here is the piece of code and the *** indicate where it says it is breaking.

if len(fName_test) > 0 then
objMail.AttachFile (fName)
'Use FSO to get file
Set fso = CreateObject"Scripting.FileSystemObject")
Set fil = fso.GetFile(fName)
'Delete file from D drive on server
fil.delete **** BREAKS HERE
end if

Thanks for your help
 
Check that the path is being resolved correctly for the file, I'm not sure if the filesystemobject can handle virtual paths, you may want to check on that by attempting to open the file and read the contents to make sure you can access it.
Also check the security permissions on the file itself, if the fold isn't set inherit on the security (so that children inherit it's settings) than the file might have tighter security access.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
This space has nothing in it, it's all ni your imagination
 
In the copy in your post, you are missing the open paranthesis around ("Scripting.FileSystemObject"), but that is probably just a typo. I agree that it is probably a path issue. This worked for me:

'Use FSO to get file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fil = FSO.GetFile("d:\mytest.txt")
'Delete file from D drive on server
fil.delete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top