# Want to do actions If a certain folder is empty and other one if it"s not

**URL:** https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556
**Category:** Discussion
**Created:** [August 9, 2007, 4:29am UTC](https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556 "2007-08-09T04:29:31Z")
**Posts on this page:** 5
**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: [August 9, 2007, 4:29am UTC](https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556/1 "2007-08-09T04:29:31Z")

</div>

Hi,

I'm beginner with Finalbuilder&nbsp;and I want to do some actions if a certain folder is empty and some other if it's not.

Do I have to take the "IF THEN" action? If it's the action that I have to take, what do I have to put on the Left-Hand value and the Right-Hand value?

Thanks

Pinky

---

<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: [August 10, 2007, 1:22am UTC](https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556/2 "2007-08-10T01:22:23Z")

</div>

Hi Genevieve,   
  
 You can do this with the “Check If File Exists” action.   
  
 First, go to Tools -\> Edit Variables and define a Project variable called “EmptyFolder” (or something similar.)   
  
 Then, add the Check If File Exists action. Set the path to C:\Path\To\My\Folder\*.\* to match any file in the directory. Set “Fail action if…” to “Do not fail” and set the variable to “Emptyfolder”.   
  
 Then, use an If…Then action with LHS = %EmptyFolder% and RHS = True.   
  
 Put the actions for the empty folder as a child of the If… Then, then add an Else action and put the actions for a full folder as the child of the Else.   
  
 Regards,   
  
 Angus   
  
 PS If there are a lot of actions as children of the If…Then or the Else, you may want to consider putting them in an action list. Right-click the “Main” tab and choose “Add Action List…”, then use a Run Action List action to run that action list from the If…Then.   
  
 PPS Please let us know if you’d like us to mock up an example project for you.

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [October 11, 2007, 3:39am UTC](https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556/3 "2007-10-11T03:39:41Z")

</div>

This will work as long as there are files in that folder.&nbsp; But what I have is many folders that are empty that are subfolders.&nbsp;

Example

C:\temp\Test1\Sub1\Sub2\Files located here

C:\temp\Test1\Sub1\Sub3\ empty

C:\temp\Test2\ - empty

C:\temp\Test4\Files

As you can tell that the file count for temp is 0 but it does have subfolders

It should delete Sub3 and Test2&nbsp; not the others

Dennis

&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: [October 12, 2007, 2:39am UTC](https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556/4 "2007-10-12T02:39:12Z")

</div>

Hi Dennis,   
  
 As far as I can tell, using _._ with Check If File Exists will match directories, so you should be fine.   
  
 If this isn’t working for you, are there any attributes set on the folders?   
  
 Regards,   
  
 Angus

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [October 12, 2007, 4:46am UTC](https://www.finalbuilder.com/forums/t/want-to-do-actions-if-a-certain-folder-is-empty-and-other-one-if-it-s-not/556/5 "2007-10-12T04:46:17Z")

</div>

I had problems with this working with the Check file so I came up with another solution that I submitted on delete empty folders which seem to work.&nbsp;
