Вот лучший способ описать это:
dirA
dir1
file1.txt
file3.txt
dirB
dir1
file1.txt
file2.txt
Я хочу скопировать содержание dirB в dirA. cp -R dirB/* dirA
удалил бы dir1
и скопируйте файлы, приводящие к:
dirA
dir1
file1.txt
file2.txt
Но я хочу объединить их (как он, был бы в Windows), и закончите с:
dirA
dir1
file1.txt
file2.txt
file3.txt
Предложения? Я попробовал ditto
, но это, кажется, игнорирует рекурсивную часть и просто выводит все файлы в папке верхнего уровня.
Использовать -i
опция к CP
-i Cause cp to write a prompt to the standard error output before
copying a file that would overwrite an existing file. If the
response from the standard input begins with the character `y'
or `Y', the file copy is attempted. (The -i option overrides
any previous -n option.)