1

I know there's many app that clean cache every boot but I would like to use init.d/script to save storage.

Dalvik-cache is /data/dalvik-cache/arm/ as I can just rm -rf *

But, app cache is located at /data/data/app_name/cache and don't know how to automate it, because cache folder is a sub-directory

I'm new to bash scripting and this would help me significantly in programming overall

Phone is magisk'ed Android 10.

2
  • that doesn't make sense you will slow down your apps, increase mobile data and premature emmc wear-out. however you can use find android.stackexchange.com/q/220648
    – alecxs
    Nov 1, 2020 at 19:31
  • 1
    It's for practice, I don't really use it. find is a great help thanks!
    – Jtnqr
    Nov 2, 2020 at 7:12

1 Answer 1

1

I forgot array is such a thing. I solved my own problem

# Assigning app-name into $apps
apps=($(ls /data/data/))

# Looping each app
for app in "${apps[@]}"; do 

  # Deleting $app/cache/ contents
  rm -rf /data/data/$app/cache/*
  done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .