mv与cp小记

目录

  • 准备

  • 更新

  • mv命令

  • cp命令

准备

mkdir demo-mv && cd demo-mv

mkdir src src/static dest dest/static

echo "v1" > src/static/index

echo "v1" > dest/static/index

find .
.
./dest
./dest/static
./dest/static/index
./src
./src/static
./src/static/index

更新

echo "v2" > src/static/index

echo "v1" > src/static/css

find .
.
./dest
./dest/static
./dest/static/index
./src
./src/static
./src/static/index
./src/static/css

mv命令

mv src/* dest/
mv: cannot move 'src/static' to 'dest/static': Directory not empty

cp命令

cp -R src/* dest/

find .
.
./dest
./dest/static
./dest/static/index
./dest/static/css
./src
./src/static
./src/static/index
./src/static/css
cat ./dest/static/index # v2
cat ./dest/static/css # v1

参考

  • mv

  • cp

你可能感兴趣的:(mv与cp小记)