renaming files using adb shell

2019-08-12 03:52发布

问题:

I want to rename a file on my android device (running CyanogenMod 11) using the adb shell. I have access to the phone via adb, but when I go to the directory where the file is located and try to rename it with mv ./file.old ./file.new I get mv ./file.old failed, Read-only file system. Tried the same with su but then I get /system/bin/sh: su: not found

Do I need to change something on my phone or somewhere else?

回答1:

You should first mount system as rw

su
mount -o remount,rw /system
mv ./file.old ./file.new


回答2:

First, You cannot rename system file directly, if it's a system file, you'll need superuser permission and you'll have to make the file system read-write. Second, Look on your phone as soon as you type su and Grant permission from phone.