Skip to content

Instantly share code, notes, and snippets.

@ayuLiao
Created March 1, 2019 06:06
Show Gist options
  • Save ayuLiao/01daf0ae0cc06df6df3b07ee33e76244 to your computer and use it in GitHub Desktop.
Save ayuLiao/01daf0ae0cc06df6df3b07ee33e76244 to your computer and use it in GitHub Desktop.
拷贝时,除去某些目录
使用 rsync 进行拷贝:
rsync 本来是文件同步备份的工具,相对于普通的 cp 命令,rsync 在控制方面就强多了,而且 rsync 对遍历目录也支持,有 --exclude 参数可以忽略指定的文件或文件夹。
rsync -vaP --exclude=".*" --exclude="Makefile" dir1 /home/dir2
如上面演示的就可以排除掉隐藏文件和 Makefile 文件,-a 参数已经包含遍历处理参数 -r。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment