Check if sync folder is empty without knowing its content - Advanced Installer Community
Tim0n
Posts: 14
Joined: Fri Sep 05, 2014 10:59 am

Check if sync folder is empty without knowing its content

Hello,

in my Setup I'm synchronizing a folder. This folder can contain "*.jar" files, but I don't know the name of these or even if they're present.

Is it somehow possible, to check if this folder is empty? I need to use this as condition for a custom action that launches a batch file.

Regards,
Timon
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Check if sync folder is empty without knowing its conten

Hi Timon,

Synchronized folders are used at development/build time and they are explained in the Working with Synchronized Folders user guide article.
Custom actions are executed at install time.

What do you mean?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tim0n
Posts: 14
Joined: Fri Sep 05, 2014 10:59 am

Re: Check if sync folder is empty without knowing its conten

Hello Mihai,

yes, during build time im synchronizing that folder, but I don't know if that folder contains any data. Let's say it depends on the customer (demo database data).

During the installation though, I need to check somehow if that folder is empty, because I need to call a custom action if it isn't (import the demo data).

So the question is, how do I check if a folder is empty, if I don't know the file names that could be in that folder? And use this as condition to call a custom action.

Regards,
Timon
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Check if sync folder is empty without knowing its conten

Hello Timon,

There's no predefined way to detect an empty folder mostly because nobody would want to install an empty folder. We do however have the possibility to delete empty folders at install time through the Folder Operations Tab.

If you're using an automated build system like ANT to create the installer you should add the logic from the build script. i.e. If the folder is empty, do not add the custom action.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”