locked
Vbscript code to delete a folder RRS feed

  • Question

  • i m using below code to delete the folder since it is used by other application i m getting 'Permission denied-Cannot delete a folder' error. so i need a code to check if the folder is in use by other application,if so kill that process and then delete that folder.

    strFolder = "C:\SP"

    SET objFSO = CREATEOBJECT("Scripting.FileSystemObject")
    objFSO.DeleteFolder strFolder

    i m trying to delete the selenium project folder,since the chromedriver instances are not killed the permission deny is coming and when i manually kill those instances i am able to delete that folder.

    • Moved by Bill_Stewart Tuesday, November 7, 2017 10:14 PM Unanswerable drive-by question
    Tuesday, September 26, 2017 8:41 AM

All replies

  • You will need to use the "openfiles" utility. There is no way in VBScript to determine what has a file open.

    openfiles /?


    \_(ツ)_/

    Tuesday, September 26, 2017 8:54 AM