I am tinkering with an app that I do not control. It creates files and then sometime later deletes them, I want to prevent it from being able to delete those files. Or if I could create a file system watcher app that would auto copy the file to a new location, that too would suffice, but I do not know if that is possible on Android. Also, I would like to be able to set this recursively on a small folder tree but if not, I can just do each folder manually.
(Note: you may need to be rooted to do this, depending on where the app is writing these files - if you do, run
su before running these commands)
Install a terminal emulator on your phone. Once it's finished installing, open it up and type
If you have enough time to type in commands while the file exists simply type
chmod -R 444 ., which will make the current directory and all subdirectories read-only.
If you don't have enough time, type something like this:
while true; do if ls | grep <filename>; then chmod -R 444 .; fi; done. Leave it running in the terminal session and when the app creates <filename> it'll make the directory and its subdirectories read-only.
(All of the above can be run in
adb shell if you prefer, but IMO installing a terminal emulator is less of a hassle)