We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More

Forum Discussion

Mark1's avatar
Mark1
Contributor
7 years ago
Solved

Deleting A Folder but getting an error

I am writing a method which deletes a folder from the C drive and copies in a new folder of the same name. 

This is my code:

 

Call aqFileSystem.DeleteFolder("C:\FolderName")

Call aqFileSystem.CopyFolder("C:\Folder123\FolderName", "C:\")

 

But when I run it(with the copy folder line commented out) the folder isn't deleted and I get a comment in my results log saying " An error occurred while deleting a file(folder)."

I cannot figure out what file in the folder is causing this as I am able to delete it manually just fine.

  • May be the folder is not empty. Try to use "DeleteFolder" with two parameters
    aqFileSystem.DeleteFolder "C:\FolderName", True

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqfilesystem/deletefolder.html?q=deleteFolder

    or check the path

1 Reply

  • May be the folder is not empty. Try to use "DeleteFolder" with two parameters
    aqFileSystem.DeleteFolder "C:\FolderName", True

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqfilesystem/deletefolder.html?q=deleteFolder

    or check the path