Rsync and ssh on android: No such file or directory -
i'm trying write android app backs data selected directory of android device remote host using rsync , ssh. when run rsync command adb shell follows, works:
rsync -rvz -e "/system/xbin/ssh -y -p 22" "/mnt/sdcard/" "rajeesh@10.0.2.2:backup/"
but java code using runtime.exec fails error says:
error: rsync: failed exec /system/xbin/ssh -y -p 22: no such file or directory (2)
the code used follows:
string[] commands = { "rsync", "-rvz", "-e", "\"/system/xbin/ssh -y -p 22\"", "\"/mnt/sdcard/\"", "\"rajeesh@10.0.2.2:backup/\"" }; process process = runtime.getruntime().exec(commands);
both rsync , ssh have been placed @ /system/xbin , chmoded 755. tried replacing "rsync" "/system/xbin/rsync" issue remains. issue here?
found out issue myself.
when run directly shell, quotes have specific meaning , required here follows:
rsync -rvz -e "ssh -y -p 22" "/path/to/src/" "/path/to/dest"
my java snippet above trying run command quotes escaped, "\"arg\"". quotes not required when used outside shell. correct usage is:
string[] commands = { "/system/xbin/rsync", "-rvz", "-e", "/system/xbin/ssh -y -p 22", "/mnt/sdcard", "rajeesh@10.0.2.2:backup/" };
Comments
Post a Comment