mv/cp를 사용하여 유효하지 않은 심볼릭 링크를 디렉토리로 대체

mv/cp를 사용하여 유효하지 않은 심볼릭 링크를 디렉토리로 대체

/tmp/bot 디렉토리로 바꾸고 싶은 심볼릭 링크가 있습니다 . 하지만 오류가 발생합니다.

mv: cannot overwrite non-directory '/tmp/bot' with directory 'log'

오류를 재현하는 단계

# Create a symlink
$ln -s bot/ /tmp/bot
$ mv log /tmp/bot
mv: cannot overwrite non-directory '/tmp/bot' with directory 'log'
$ mv -f log /tmp/bot
mv: cannot overwrite non-directory '/tmp/bot' with directory 'log'
$ cp -r log/ /tmp/bot
cp: cannot overwrite non-directory '/tmp/bot' with directory 'log/'
$ cp -rf log/ /tmp/bot
cp: cannot overwrite non-directory '/tmp/bot' with directory 'log/'

간단한데 할 수가 없어요. 한 가지 옵션은 /tmp/bot을 제거한 다음 디렉토리를 이동하는 것입니다. 하지만 내가 사용하고 있는
mv를 사용하여 수행할 수 있는지 알고 싶습니다.
ubuntu 18.04

답변1

하지만 mv를 사용하여 수행할 수 있는지 이해하고 싶습니다.

mv및 의 매뉴얼 페이지 에 따르면 cp그렇게 할 수 없습니다. 먼저 사용하셔야 합니다 rm.

관련 정보