[英]How to copy all files inside a remote directory?
The command to copy a single file remotely is Runtime.getRuntime().exec("sshpass -p sbsiz scp '/home/surendra/Desktop/remote_backup.txt' root@192.168.59.115:/home/");
远程复制单个文件的命令是
Runtime.getRuntime().exec("sshpass -p sbsiz scp '/home/surendra/Desktop/remote_backup.txt' root@192.168.59.115:/home/");
But how is the syntax to copy all files inside the /home/surendra/Desktop
directory ? 但是,复制
/home/surendra/Desktop
目录内的所有文件的语法如何?
Did you try wild card option? 您尝试过通配符选项吗? like
scp /local-directory/* root@<some-host>:/remote-directory
像
scp /local-directory/* root@<some-host>:/remote-directory
In your case run following. 在您的情况下,请执行以下操作。
Runtime.getRuntime().exec(new String[] {"/bin/sh","-c", "sshpass -p sbsiz scp '/home/surendra/Desktop/*' root@192.168.59.115:/home/"});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.