0
例如,考虑合并两个目录保持较大的文件
mkdir dir1
mkdir dir2
cd dir1
echo "This file contains something" > a
touch b
echo "This file contains something" > c
echo "This file contains something" > d
touch e
cd ../dir2
touch a
echo "This file contains something" > b
echo "This file contains something" > c
echo "This file contains more data than the other file that has the same name but is in the other directory. BlaBlaBlaBlaBlaBlaBlaBlaBla BlaBlaBlaBlaBlaBlaBlaBlaBla BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla. bla!" > d
我想合并dir1
和dir2
。如果两个文件具有相同的名称,则只有最大尺寸的文件必须保留。这里是合并后的目录
a # Comes from `dir1`
b # Comes from `dir2`
C# Comes from either `dir1` or `dir2`
d # Comes from `dir2`
e # Comes from `dir1`(is empty)
你能展示你的尝试吗?目录是递归的吗? – andlrc