Page 1 of 1
folder size condition?
Posted: 14 Mar 2014 08:25
by holymoz
hi, is there a way to make a condition if a generic folder exceeds or nota certain size? thanks
Re: folder size condition?
Posted: 14 Mar 2014 10:28
by Martin
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
Re: folder size condition?
Posted: 14 Mar 2014 11:41
by holymoz
thanks bro I'll try it
Re: folder size condition?
Posted: 14 Mar 2014 17:33
by holymoz
ok works, thanks
Re: folder size condition?
Posted: 15 Mar 2014 08:41
by Martin
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;