# Delete Directory action failing

**URL:** https://www.finalbuilder.com/forums/t/delete-directory-action-failing/654
**Category:** Discussion
**Created:** [November 9, 2007, 1:12am UTC](https://www.finalbuilder.com/forums/t/delete-directory-action-failing/654 "2007-11-09T01:12:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cpdaniel](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@cpdaniel](https://www.finalbuilder.com/forums/u/cpdaniel)
#### Post date: [November 9, 2007, 1:12am UTC](https://www.finalbuilder.com/forums/t/delete-directory-action-failing/654/1 "2007-11-09T01:12:53Z")

</div>

Sporadically (maybe 1 out of 3 times?) I'm having problems with the Delete Directory task failing with the error:

> Unable to Delete Directory : C:\BuildTemp
> 
> System Error.&nbsp; Code:145
> 
> The directory is not empty

I have all the options checked - delete sub directories, delete read-only directories, delete hidden directories.

If I restart the build from the failed operation, the delete always succeeds the second time.

This is on WinSvr 2003 R2 SP2 x64, with FB5.5.0.340

&nbsp;

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 9, 2007, 9:38am UTC](https://www.finalbuilder.com/forums/t/delete-directory-action-failing/654/2 "2007-11-09T09:38:01Z")

</div>

Hi Carl,   
  
 It sounds like something else might be accessing the directory at the time you’re trying to delete it. The usual suspects are antivirus tools, and indexing tools like Google Desktop.   
  
 As a “quick n dirty” fix, each action has a “retry count” you can set with a pause value between tries. This can be accessed on the Runtime tab for the action. Set the retry count to 4 or 5 and FinalBuilder will try multiple times before failing out.   
  
 Regards,   
  
 Angus

---

<div class="post-metadata">

### Author: ![cpdaniel](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@cpdaniel](https://www.finalbuilder.com/forums/u/cpdaniel)
#### Post date: [November 9, 2007, 5:12am UTC](https://www.finalbuilder.com/forums/t/delete-directory-action-failing/654/3 "2007-11-09T05:12:09Z")

</div>

I bet you're right.&nbsp; I've got Windows Desktop Search running, and I'm sure it's got that pesky indexing service running, "helping me" by indexing all my temporary source files.

I'll give the retry option a try, thanks!

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [November 12, 2007, 2:57am UTC](https://www.finalbuilder.com/forums/t/delete-directory-action-failing/654/4 "2007-11-12T02:57:12Z")

</div>

I hit this problem all the time. It’s a major pain in the arse, but it doesn’t seem to be FinalBuilder’s fault. The “retry” method mentioned usually works…   
  
 In many cases, what you actually really want is to clean out the directory rather than to delete it, so also see if you can replace the “delete directory” with “delete files”, which stands a better chance of working.   
  
 Failing that, there is “unlocker” - google it.   
  
 Steve
