Nonhocapito
New member
As the title says. As I am new to both Macrodroid and scripting in bash in general, no surprise I got stuck.
My purpose is to know how many files are in a folder and, if they're too many, delete the oldest ones.
To begin with, I am using a shell script that uses
"ls -m" followed by folder path.
(i previously complained this didn't work, but actually it does now, I needed to remove "root" from the script)
My next step would be to count the items in that comma-separated string... How to achieve this via script? Or should I transfer it into an array?
EDIT: I did manage to extract the number of commas via script. The only problem is that this number can only be saved to a string, and I cannot "count" it or compare it to another number....
My purpose is to know how many files are in a folder and, if they're too many, delete the oldest ones.
To begin with, I am using a shell script that uses
"ls -m" followed by folder path.
(i previously complained this didn't work, but actually it does now, I needed to remove "root" from the script)
My next step would be to count the items in that comma-separated string... How to achieve this via script? Or should I transfer it into an array?
EDIT: I did manage to extract the number of commas via script. The only problem is that this number can only be saved to a string, and I cannot "count" it or compare it to another number....
Last edited: