given two directory trees how to find which files are the same?

后端 未结 2 1935
借酒劲吻你
借酒劲吻你 2021-01-31 08:29

I am writing a bash script, and I would like to know which files are the same in two directory trees.

It would be the opposite of using diff.

Well i found the a

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-31 09:08

    You can use a utility like fdupes or rdfind to list duplicate files. For example:

    fdupes --recurse dir1 dir2
    

    You might also want to use the --sameline flag to list all duplicates on the same line, rather than in text blocks, depending on how you want to parse the results.

提交回复
热议问题