linux - Find common files between two folders -


given 2 root folders , b,

how can find duplicate text files between subfolders of , of b ?

in other words, considering intersection of files , b.

i dont want find duplicate files within a, or within b, files, in , in b.

edit

by duplicate mean files same content

as indicated in comments section, generate single md5 checksum each file, once - duplicated checksums.

something this:

find dira -name \*.txt -exec md5sum {} +  > /tmp/a find dirb -name \*.txt -exec md5sum {} +  > /tmp/b 

now find checksums occur in both files.

so, along these lines:

awk 'fnr==nr{md5[$1];next}$1 in md5' /tmp/[ab] 

or maybe this:

awk 'fnr==nr{s=$1;md5[s];$1="";name[s]=$0;next}$1 in md5{s=$1;$1="";print name[s] " : " $0}' /tmp/[ab] 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -