9

好的,所以我有点知道如何使用 find then cp 命令在本地执行此操作,但不知道如何使用 scp 远程执行相同操作。

所以知道这个:

scp -vp me@server:/target/location/ /destination/dir/.

该目标目录将充满数据库备份,我如何告诉它找到最新的备份,并在本地 scp 呢?

4

2 回答 2

11
remote_dir=/what/ever
dst=remote-system.host.name.com
scp $dst:`ssh $dst ls -1td $remote_dir/\* | head -1` /tmp/lastmod
于 2010-11-06T05:09:10.213 回答
1

在远程端编写一个脚本,用于find查找它,然后cat将其发送到标准输出,然后运行:

ssh me@server runscript.sh > localcopy
于 2010-11-06T05:05:10.333 回答