linux命令行,如何删除某个指定目录A内与另一个或多个目录B重复的文件?
目录B内的文件保留
fdupes貌似不能指定只删除A的
ringa_lee2017-04-17 13:15:59
Checked dozens of web pages and found this nearly satisfactory solution
http://unix.stackexchange.com/questions/146197/fdupes-delete-files-aft...
However, the exclamation point in the regular expression does not seem to have the effect of clearing blank lines, so it is changed to d;
fdupes --recurse A/ B/ | sed '/^A/d; /^$/d; s/.*/"&"/' | xargs rm
But there is still a small problem. If there is a duplicate file in A, but the file is not in B, fdupes will also list it as a result, resulting in accidental deletion. Please think again