On my windows laptop, I have a batch file which checks for a specific file and deletes it. My question is, is this possible on android, to make a file that runs at startup (without root), checks for the existence of a directory called "thumbnails" in /storage/sdcard0/DCIM", if exists, delete. Answers greatly appreciated
1 Answer
Sure that is possible. Many automation apps (see our automation tag-wiki) offer that. I e.g. use tasker (see: tasker tag-wiki) which offers to perform actions on device boot, and can execute shell commands. So a typical Tasker profile could be fired "on device boot" to "execute shell command" rm -rf /storage/sdcard0/DCIM/thumbnails
. No check needed for the existence of that directory: If it existes, that command would remove it – and if it not exists, result is the same :)
While Tasker is not free (there's a 7 day trial, though) there are other free automation apps you could check with. I don't have a list of which ones provide on-boot command execution, so you had to look that up yourself.
In case your device is rooted, you'd have additional possibilities – e.g. utilizing init scripts. If your device doesn't support them as-shipped, there are some apps which could help adding that feature.
Disclosure: the linked app lists are my product, so those links go to my website.
-
Thank you so much, but is there a way that I could do that without third party apps? Nov 10, 2016 at 10:27
-
Please read the last paragraph again: If your device is rooted and supports init scripts, you can. Otherwise I'm not aware of any such possibility.– Izzy ♦Nov 10, 2016 at 10:29
-
Wow, I Just bought tasker, IT'S AMAZING!!! I would never have known there was such a thing! IT IS ALMIGHTY POWERFUL! thanks for recomending it. Nov 14, 2016 at 10:24
-
It definitely is! I'm using it for years already. So if you're looking for ideas, see my Tasker resource collection :)– Izzy ♦Nov 14, 2016 at 12:24
-
1Great page. Read through it in about half an hour! Was totally worth it!! Nov 19, 2016 at 10:12