cancel
Showing results for 
Search instead for 
Did you mean: 

DeleteFolder doesn't work

SOLVED
New Contributor

DeleteFolder doesn't work

Hi!

 

We try this (with TC 12.6) to empty a temporary folder with testdata before running each test:

 

if aqFileSystem.Exists(Spath):
   aqFileSystem.DeleteFolder(Spath, True)

 

but TestComplete gives an error and the log says:

 

The directory is not empty.
 
If the directory _is_ empty, then it is deleted. But the True parameter should delete the folder no matter what. At least that is how I read the documentation...
 
Thanks for any help!
1 ACCEPTED SOLUTION

Accepted Solutions
New Contributor

Re: DeleteFolder doesn't work

OK, so someone else in the company just found the problem: if the folder is open in e.g. Windows Explorer, you get this message! All files and folders in the folder are deleted, but the folder itself is not. And TC gives an error about the folder not being empty.

 

2 REPLIES 2
New Contributor

Re: DeleteFolder doesn't work

OK, so someone else in the company just found the problem: if the folder is open in e.g. Windows Explorer, you get this message! All files and folders in the folder are deleted, but the folder itself is not. And TC gives an error about the folder not being empty.

 

Community Hero

Re: DeleteFolder doesn't work

Right... because the folder is, technically, in use and the file system won't allow you to delete the object while it's in use.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Top Kudoed Authors