rsync命令执行必须保证源目录、目标目录、当前目录
$PWD
都存在
在服务器上执行 rsync
同步两个目录中文件时报如下错误:
[public@xxxx 31]$ rsync -zvr /test/shared/ /pre/shared/
rsync: getcwd(): No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at util.c(1094) [Receiver=3.1.3]
已确定 /test/shared/
和 /pre/shared/
目录都存在
rsync命令执行时,命令窗口所在的当前目录
$PWD
必须存在
因为我是在一个已删除的目录中执行的rsync命令,所以报错了。
只需将当前目录切换到一个存在的文件夹,再重新运行 rsync
命令就好了