# Delete directory \*contents\* only

**URL:** https://www.finalbuilder.com/forums/t/delete-directory-contents-only/4159
**Category:** Feature Requests
**Created:** [July 20, 2011, 10:11am UTC](https://www.finalbuilder.com/forums/t/delete-directory-contents-only/4159 "2011-07-20T10:11:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [July 20, 2011, 10:11am UTC](https://www.finalbuilder.com/forums/t/delete-directory-contents-only/4159/1 "2011-07-20T10:11:12Z")

</div>

It would be nice if the _Delete Directory_ action would allow for deleting a tree but leaving the toplevel (specified) directory alone.

I have a common-ish folder for our buildscripts that I would like to clean out completely (recursively), but I'm a bit worried about deleteing the toplevel folder itself (that it might fail because some process still holds a lock to the folder /&nbsp;or that it might succeed and some other process fails because the expected folder ain't there).

So my wish would be to have an additional option for the Delete Directory action:  
**[] Leave the toplevel directory (only delete contents)**

As far as I can see, to achieve this at the moment I would need to chain together a _file set define_ and _file set delete files_ ...

cheers,  
Martin

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [July 20, 2011, 10:26am UTC](https://www.finalbuilder.com/forums/t/delete-directory-contents-only/4159/2 "2011-07-20T10:26:27Z")

</div>

Addendum: I just noticed that FileSetDeleteFiles doesn’t work, as I can include directories in the file set, but it’s not possible to delete these via FileSetDeleteFiles.   
  
 Addendum: I also noticed that the _Delete File(s)_ action is “missing” an option to log all the files deleted.
