totalimpact
asked on
VBScript cannot delete folder - permission denied
I have 3 scripts that I am combining into 1, now when I run it, I get a permission denied error at line #119. subfolder.Delete
If I run that section standalone its fine.
Here is the script.
http://pastebin.com/tfEs1TVC
I think it has something to do with 2 different sections using FSO.
Here is a folder structure that I am working with as a point of reference (several csv files in these):
If I run that section standalone its fine.
Here is the script.
http://pastebin.com/tfEs1TVC
I think it has something to do with 2 different sections using FSO.
Here is a folder structure that I am working with as a point of reference (several csv files in these):
try to replace line 119 with
objFSO.DeleteFolder subfolder.Path, True
/Cheers
Daniel
objFSO.DeleteFolder subfolder.Path, True
/Cheers
Daniel
ASKER
Something within the script is locking it, something in the code section above that one. Because if I try to delete it manually while the Msg box is open, its locked, but if I run that code section stand alone (lines 33-125) without all the other code, it deletes it fine.
Not sure, but the only code above that is the FTPDownload function call, which is here:
http://pastebin.com/ddcRr8SK
I can see ftp.exe launch in the task manager while the part of the code is running, and then it closes.
Not sure, but the only code above that is the FTPDownload function call, which is here:
http://pastebin.com/ddcRr8SK
I can see ftp.exe launch in the task manager while the part of the code is running, and then it closes.
ASKER
Not sure what changed, But I now get the permission denied earlier at line 109:
I think something isnt closing properly.
objfso.MoveFolder Subfolder.Path,subfolder_ar
I think something isnt closing properly.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
WOW - that did it, you deserve extra credit.
Thanks for the points, glad I could help!
Daz.
Daz.
1. Are there any SubFolders in there? Try amending line 117 to
Open in new window
2. Do you, or anyone on the network, have that folder open in a Windows Explorer window?3. Have you, or anyone on the network, got a command prompt window open and the current folder in that window is the one attempting to be deleted?
4. Double check the permissions on the folder. You know that this is not the problem, but you should double-check anyway!
Regards,
Daz.