0
A
回答
4
在OS X上,你应该使用-R
而非-r
。手册页(在Snow Leopard 10.6.8上)说:
历史版本的cp实用程序有一个
-r
选项。该实现支持该选项;然而,它的使用是强烈的不鼓励,因为它不正确地复制特殊文件,符号链接或fifo的。
+0
太棒了!不知道..谢谢! – ClauCece
1
cp
命令的递归选项将用于目录而不是文件。该文件指出:
-R, -r, --recursive
copy directories recursively
的OSX docs有更多的信息,但不建议在选项可以与文件一起使用。相反,它仍然提到了它们用于复制目录内容:
-R If source_file designates a directory, cp copies the directory and the entire subtree connected
at that point. If the source_file ends in a /, the contents of the directory are copied rather
than the directory itself. This option also causes symbolic links to be copied, rather than
indirected through, and for cp to create special files rather than copying them as normal files.
Created directories have the same mode as the corresponding source directory, unmodified by the
process' umask.
In -R mode, cp will continue copying even if errors are detected.
Note that cp copies hard-linked files as separate files. If you need to preserve hard links, consider using tar(1), cpio(1), or pax(1) instead.
相关问题
- 1. UNIX复制隐藏和非隐藏一个复制命令
- 2. Ansible递归目录复制
- 3. Python:递归复制一批目录
- 4. 在Linux/UNIX上以纯C递归复制目录
- 5. 在tcl中递归复制目录
- 6. PHP FTP复制目录递归
- 7. 如何复制一个目录并递归地忽略某个目录?
- 8. 用python递归复制和拼合一个目录
- 9. Unix c程序递归列出目录
- 10. 在UNIX中隐藏文件或目录
- 11. 如何递归复制在Linux/Unix上以“abc”开头的目录?
- 12. os.path.isdir()不能识别隐藏的目录
- 13. 删除Unix中的递归目录(无限子目录)
- 14. 在Python中跳过一些目录递归复制文件?
- 15. 如何将一个目录变成一个隐藏的目录
- 16. 在PowerShell中递归地将一组文件从一个目录复制到另一个目录
- 17. 将三个最新的文件复制到一个目录下(递归)到另一个指定的目录
- 18. 目录递归
- 19. 在Python中递归复制文件或目录
- 20. 如何递归复制SDcard目录和子目录到其他smb目录(samba)?
- 21. 如何删除一个目录递归
- 22. mod_rewrite不隐藏子目录
- 23. 如何创建一个隐藏目录
- 24. 使用shell脚本递归复制目录
- 25. 全局递归/零个或多个目录,不包括目录
- 26. 递归恢复目录扫描
- 27. bash脚本 - 在一个目录中最新版本的文件复制递归
- 28. 创建一个递归目录树功能
- 29. Ruby递归目录
- 30. java.lang.StackOverflowError递归目录
我刚试过,它工作正常。 – Barmar
我现在尝试了'cp -R ../openshiftapp/.openshift .',它工作。不过谢谢。 – ClauCece
是'.openshift'文件还是目录?递归拷贝仅对目录有意义,否则没有任何可递归的内容。 – Barmar