码迷,mamicode.com
首页 > 其他好文 > 详细

对比内容相同但名字不一样的文件

时间:2020-01-16 12:26:41      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:com   对比   get   find   参数   pre   支持   -name   file   

date;find /home/admin/image -name *.jpeg | xargs md5sum|sort >allfiles;cat allfiles |uniq -w 32 > uniqfiles;comm allfiles uniqfiles -2 |cut -c 35-|wc -l;date
date;find /home/admin/image -name *.jpeg | xargs md5sum|sort >allfiles;cat allfiles |uniq -w 32 > uniqfiles;comm allfiles uniqfiles -2 |cut -c 35-|tr \n \0|xargs -n `getconf ARG_MAX`  rm;date

PS:

1. rm 可支持带的文件数以 getconf ARG_MAX为准,

2. 不使用exec,因为exec一次只能rm一个,xargs可支持带多个参数;

对比内容相同但名字不一样的文件

标签:com   对比   get   find   参数   pre   支持   -name   file   

原文地址:https://www.cnblogs.com/bowanghou/p/12200500.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!