如何将一个目录中的文件拷贝到另一个目录,并在拷贝时忽略你不想要的文件或目录
2016-05-25 17:02
991 查看
这个需求不要用cp命令了,因为那牵扯到太多的正则表达式,太复杂。简单一点的方法是用rsync命令。
用法示例:
rsync -av --progress a/ b/ --exclude 3/
以上命令将目录a中的所有内容复制到目录b中,并在复制过程中忽略掉目录a中的目录3
注意:
--exclude 参数后的路径必须是相对于拷贝源的,此例中即是相对与目录a的。而且此处不能用绝对路径只能用相对路径!!!!!
如,这样就不对了:rsync -av --progress a/ b/ --exclude /home/liyaochuan/work/test/a/3/
可以有多个--exclude参数,
如:rsync -av --progress a/ b/ --exclude 3/ --exclude 2/
以下内容只针对我当前的狗日的被强奸的工作模式做个笔记,请略过!
目前的工作,在顶层目录用svn up命令更新完代码后,按照如下步骤来管理狗日的本地base和狗日的本地mode:
0. 先在狗日的 v90_pro中的kernel中执行clean
make distclean
将编译中间文件删除干净,后续才能方便的做这狗日的更新!
1. 在顶层目录执行svn up
liyaochuan@dttzd-05:~/work/V$ svn up
2.
用git管理狗日的base中的kernel
cd ~/work/V/base/kernel/linux-3.10
git add .
git commit -m "add the the update of the fuck base on revision xxxx "
用git管理狗日的mode中的kernel
cd ~/work/V/mode/kernel/linux-3.10
git add .
git commit -m "add the the update of the fuck mode on revision xxxx "
3. 将狗日的base目录和狗日的mode目录合并成狗日的v90_pro目录
先把狗日的base中的全部内容复制到狗日的 v90_pro中,忽略掉kernel中的.git
cd ~/work/V
rsync -av --progress base/ v90_pro/ --exclude kernel/linux-3.10/.git/
再把狗日的mode中的全部内容复制到狗日的 v90_pro中,忽略掉kernel中的.git
cd ~/work/V
rsync -av --progress mode/ v90_pro/ --exclude kernel/linux-3.10/.git/
完毕,用git管理一下这狗日的v90_pro中的kernel
cd ~/work/V/v90_pro/kernel/linux-3.10
git add .
git commit -m "add the the update of the fuck base and the fuck mode on revision xxxx "
好了可以了。最后在fuck一次这狗日的base和狗日的mode
用法示例:
rsync -av --progress a/ b/ --exclude 3/
以上命令将目录a中的所有内容复制到目录b中,并在复制过程中忽略掉目录a中的目录3
注意:
--exclude 参数后的路径必须是相对于拷贝源的,此例中即是相对与目录a的。而且此处不能用绝对路径只能用相对路径!!!!!
如,这样就不对了:rsync -av --progress a/ b/ --exclude /home/liyaochuan/work/test/a/3/
可以有多个--exclude参数,
如:rsync -av --progress a/ b/ --exclude 3/ --exclude 2/
以下内容只针对我当前的狗日的被强奸的工作模式做个笔记,请略过!
目前的工作,在顶层目录用svn up命令更新完代码后,按照如下步骤来管理狗日的本地base和狗日的本地mode:
0. 先在狗日的 v90_pro中的kernel中执行clean
make distclean
将编译中间文件删除干净,后续才能方便的做这狗日的更新!
1. 在顶层目录执行svn up
liyaochuan@dttzd-05:~/work/V$ svn up
2.
用git管理狗日的base中的kernel
cd ~/work/V/base/kernel/linux-3.10
git add .
git commit -m "add the the update of the fuck base on revision xxxx "
用git管理狗日的mode中的kernel
cd ~/work/V/mode/kernel/linux-3.10
git add .
git commit -m "add the the update of the fuck mode on revision xxxx "
3. 将狗日的base目录和狗日的mode目录合并成狗日的v90_pro目录
先把狗日的base中的全部内容复制到狗日的 v90_pro中,忽略掉kernel中的.git
cd ~/work/V
rsync -av --progress base/ v90_pro/ --exclude kernel/linux-3.10/.git/
再把狗日的mode中的全部内容复制到狗日的 v90_pro中,忽略掉kernel中的.git
cd ~/work/V
rsync -av --progress mode/ v90_pro/ --exclude kernel/linux-3.10/.git/
完毕,用git管理一下这狗日的v90_pro中的kernel
cd ~/work/V/v90_pro/kernel/linux-3.10
git add .
git commit -m "add the the update of the fuck base and the fuck mode on revision xxxx "
好了可以了。最后在fuck一次这狗日的base和狗日的mode
相关文章推荐
- 处理文件touch、mkdir、cp、mv、rm
- 动态清空 nohup 输出文件
- 使用 rsync 复制大文件的一些误解
- 如何在 Linux 上复制文件/文件夹到远程系统?
- 如何在使用 scp 命令时递归地排除文件
- sql server 复制表从一个数据库到另一个数据库
- C#中数组初始化与数组元素复制的方法
- 浅析C#的复制和克隆
- C#实现复制文件夹中文件到另一个文件夹的方法
- C#实现把dgv里的数据完整的复制到一张内存表的方法
- SQL Server数据复制到的Access两步走
- TCP三次握手及原理
- rsync 限制速度(防止rsync耗带宽)
- 利用xcopy命令实现本地文件复制到远程服务器的方法
- php检索或者复制远程文件的方法
- php实现复制移动文件的方法
- php不使用copy()函数复制文件的方法
- 复制Input内容的js代码_支持所有浏览器,修正了Firefox3.5以上的问题
- Javascript 实现复制(Copy)动作方法大全
- JavaScript深度复制(deep clone)的实现方法