"cp/rsync/scp",通过将子文件夹排除到远程/本地计算机中



我有50个文件夹,每个文件夹中都有lib目录,我想在将其scp/cp放入远程/本地机器文件夹时将其排除在外。我没有找到任何使用scp的解决方案,但大量使用rsync(它没有安装在loca m/c中)。

我会用find:选择您想要的文件

find . -type f ! -path '*/lib/*'

然后你可以对这些文件进行标记并复制标记文件:

file . -type f ! -path '*/lib/*' -print0 
| xargs -0 tar zcf - 
| ssh remote_host sh -c 'cd /destination/dir && tar zxvf -'

最新更新