I would like to check whether a directory exists on the SD card of an Android device using Bash.
I am aware that a similar question was answered here: How can I check if a directory exists in a Bash shell script?
The difference is that when I do
if [ -e /sdcard/myDir ]; then
# magic
fi
it is checked whether /sdcard/myDir exists on my computer and not on the phone. How can I check if the folder exists on the phone?
If I understood you correctly try:
… and then type your shell commands on the device. I’m not really sure if bash is available on standard Android device. I’d bet that there are only simple busybox tools installed.
Also note, that there is very limited set of directories that you will be able to access this way on non-rooted device.
UPDATE:
More precisely, if you need to execute some kind of shell script on the remote device, first prepare the script, say
foo.shand then execute:That should do the trick.