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

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可支持带多个参数;

猜你喜欢

转载自www.cnblogs.com/bowanghou/p/12200500.html
今日推荐