folder size condition?

Post your questions and help other users.

Moderator: Martin

Post Reply
holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

folder size condition?

Post by holymoz » 14 Mar 2014 08:25

hi, is there a way to make a condition if a generic folder exceeds or nota certain size? thanks

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: folder size condition?

Post by Martin » 14 Mar 2014 10:28

Hi,

There's no built-in action/trigger for this. You could use an action Execute Command: du -sk /path/to/directory to check the size of the contents of a folder in kilobytes (du needs to be installed on the ROM or requires to install busybox) and then use a condition Expression to analyze the result of the command output.
You could either execute this action periodically or by using a trigger File Observer when your device sends the proper events for the folder in question.

Regards,
Martin

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: folder size condition?

Post by holymoz » 14 Mar 2014 11:41

thanks bro I'll try it

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: folder size condition?

Post by holymoz » 14 Mar 2014 17:33

ok works, thanks

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: folder size condition?

Post by Martin » 15 Mar 2014 08:41

You could use function split to create a list and use the first element of the list (\\s matches white-space characters like space and tabulator):

Code: Select all

list = split(stdout, "\\s+");
size = getElement(list, 0);
size>100000;
You could also remove everything after the first white-space:

Code: Select all

size = replaceAll(stdout, "\\s.*", "");
size>100000;

Post Reply