I wanted to do something with my Android phone using ADB commands, while keeping it plugged in to run the said commands. However, the thing I wanted to test was related to the idle (dozing or asleep) mode of Android devices. The workaround was to spoof the battery state to bypass Android’s charging restrictions. Spoofing […]
command line
Android emulator shell list fails: Permission Denied in app directory
Today I learned I should include the app package name after shell in my ADB command, if for example I want to list files under the “subdirectory/media” directory of an app, like so: adb -s emulator-5556 shell run-as com.domain.my.app ls -al /data/user/0/com.domain.my.app/subdirectory/media First try’s command below failed with a Permission Denied error message: adb -s […]
Bash: rename all files in directory, replacing all hyphens (-) with underscores (_)
I don’t want to waste time doing things manually when I can run a script that will help me save time and effort. When using Linux or Mac command line (bash?), if you want to rename all files in your present directory and replace all hyphens – with underscores _, run this command:
|
1 |
for f in *-*; do mv "$f" "${f//-/_}"; done |
And […]