Ubuntu删除两个文件夹下同名同内容的文件V1.2

http://blog.csdn.net/u010555688/article/details/51280783 Ubuntu删除两个文件夹下同名同内容文件 参考:http://bbs.chinaunix.net/forum.PHP?mod=viewthread&tid=1851432&page=1 缘起:一直在维护android的BSP,有时候发现另外一个来源的BSP有你所需要的一些功能。 因此需要有一个工具,比对两份代码,将两份BSP里面的相同文件名(内容也完全相同)的文件删除掉。 1、列出两个文件夹dir1、dir2下相同的文件: (英文版本ubuntu) diff -rs dir1 dir2|grep 'identical$' (中文版本ubuntu) rootroot@rootroot-E400:~$ cd wyb/ rootroot@rootroot-E400:~/wyb$ cd diff/ rootroot@rootroot-E400:~/wyb/diff$ diff -rs rtl8188eu4a/ rtl8188eu6a/ | grep "相同$" > 3.txt 2、删除同名同内容文件(只需要执行一次): awk '{print $2}' 3.txt | xargs rm -rf awk '{print $4}' 3.txt | xargs rm -rf find r58_20160823/ -name "*" -type d -empty | xargs rm -rf find r58_evb_sc5806/ -name "*" -type d -empty | xargs rm -rf http://bbs.csdn.net/topics/320031351 awk如何删除一个文件? 3、工作基本上做完了,但是会出现很多空目录: http://www.111cn.net/sys/linux/46433.htm linux中find批量删除文件及空文件夹脚本 (需要多执行几次,有些目录里面只有空目录!!!!) find -type d -empty | xargs rm -rf find . -name "*" -type d -empty | xargs rm -rf rootroot@rootroot-E400:~/wyb/diff$ find -type d -empty ./rtl8188eu4a/os_dep/linux ./rtl8188eu4a/include/byteorder ./rtl8188eu4a/include/linux ./rtl8188eu4a/core/efuse ./rtl8188eu4a/hal/hal_hci ./rtl8188eu4a/hal/OUTSRC-BTCoexist ./rtl8188eu4a/hal/OUTSRC/rtl8188e ./rtl8188eu4a/hal/led ./rtl8188eu4a/hal/rtl8188e/usb ./rtl8188eu6a/os_dep/linux ./rtl8188eu6a/include/byteorder ./rtl8188eu6a/include/linux ./rtl8188eu6a/core/efuse ./rtl8188eu6a/hal/hal_hci ./rtl8188eu6a/hal/OUTSRC-BTCoexist ./rtl8188eu6a/hal/OUTSRC/rtl8188e ./rtl8188eu6a/hal/led ./rtl8188eu6a/hal/rtl8188e/usb rootroot@rootroot-E400:~/wyb/diff$ find . -name "*" -type d -empty ./rtl8188eu4a/os_dep/linux ./rtl8188eu4a/include/byteorder ./rtl8188eu4a/include/linux ./rtl8188eu4a/core/efuse ./rtl8188eu4a/hal/hal_hci ./rtl8188eu4a/hal/OUTSRC-BTCoexist ./rtl8188eu4a/hal/OUTSRC/rtl8188e ./rtl8188eu4a/hal/led ./rtl8188eu4a/hal/rtl8188e/usb ./rtl8188eu6a/os_dep/linux ./rtl8188eu6a/include/byteorder ./rtl8188eu6a/include/linux ./rtl8188eu6a/core/efuse ./rtl8188eu6a/hal/hal_hci ./rtl8188eu6a/hal/OUTSRC-BTCoexist ./rtl8188eu6a/hal/OUTSRC/rtl8188e ./rtl8188eu6a/hal/led ./rtl8188eu6a/hal/rtl8188e/usb rootroot@rootroot-E400:~/wyb/diff$

相关文章

ubuntu退出redis的示例:指定配置文件方式启动源码redis:roo...
ubuntu中mysql改密码忘了的解决方法:1.在终端中切换到root权...
ubuntu安装mysql失败的解决方法原因:可能是原有的MySQL还有...
使用centos和ubuntu建站的区别有以下几点1.CentOS是Linux发行...
ubuntu图形界面和字符界面切换的方法:可以通过快捷键CTRL+A...
ubuntu中重启mysql失败的解决方法1.首先,在ubuntu命令行中,...