问题
I am trying to copy the shared preferences folder of my app to the /sdcard partition from my PC using the following ADB command:
adb shell su -c "cp /data/data/com.anrapps.pixelbatterysaver/shared_prefs/ /sdcard/appdata/"
But this returns cp: Skipped dir '/data/data/com.anrapps.pixelbatterysaver/shared_prefs': No such file or directory
. However when executing the ls command, it says that folder is present:
adb shell su -c "ls /data/data/com.anrapps.pixelbatterysaver"
cache code_cache files shared_prefs
What is the problem? May be permission related?
回答1:
If you're trying to copy a whole directory, you need to use cp -r
to make it a recursive copy.
来源:https://stackoverflow.com/questions/39961621/no-such-file-or-directory-when-cp-but-not-with-ls