Duplicate files with the same deleted contents as shell scripts

Source: Internet
Author: User

#!/bin/bash

#! Delete duplicate files with identical contents

Ls-ls--time-style=long-iso | awk ' begin{

Getline;getline;

Name1=$8;size=$5

}

{

name2=$8;

if (size==$5)

{

"Md5sum" name1 | getline;csum1=$1;

"Md5sum" name2 | getline;csum2=$2;

if (csum1==csum2)

{

Print Name1;print name2

}

};

szie=$5;name1=name2;

} ' | Sort-u > Duplicate_files

Cat Duplicate_files | Xargs-i md5sum {} | Uniq-w 32 | awk ' {print ' ^ "$" $ "'} ' | Sort-u > Duplicate_sample

Echo removing ...

Comm Duplicate_files Duplicate_sample-2-3 | Tee/dev/stderr | EXEC RM-RF

Echo removed successfully

  

Duplicate files with the same deleted contents as shell scripts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.