mac 命令行 复制目录
Copying a directory for the sake of backup is something I do often, especially when I'm trying to figure out why something isn't working when I use an external library. I'll copy the directory structure as a backup, mess around with the original source until I find a solution, then restore the original and change my overall system code to bring in my revised version.
为了备份而复制目录是我经常要做的事情,尤其是当我试图弄清为什么使用外部库时某些东西无法正常工作时。 我将复制目录结构作为备份,将原始源弄乱,直到找到解决方案,然后还原原始源并更改整个系统代码以引入修订版。
You can't just use cp
to copy a directory structure -- you'll see cp: myDir is a directory (not copied).
You'll need to add a few additional flags to copy a directory structure:
您不能只使用cp
复制目录结构-您会看到cp: myDir is a directory (not copied).
您需要添加一些其他标志来复制目录结构:
cp -Rp source source_copy
The above command copies the directory recursively while keeping the same permissions!
上面的命令以递归方式复制目录,同时保留相同的权限!
mac 命令行 复制目录