Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我想将scp当前目录中除*m文件(matlab 代码)之外的所有文件发送到远程服务器,我该如何做到这一点?特别是使用 bash 脚本。
scp
*m
谢谢,约翰
使用递归 scp:
scp -r ... *[^m]
如果目录结构复杂,一个技巧是使用tar
tar
tar c --exclude="*.m" . | ssh remote_server "tar x -C /some/directory/"
它还保留了所有权、权限、符号链接等。