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

Hi,

I'm beginner with Finalbuilder 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

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.

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

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  not the others

Dennis

 

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

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.