Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在升级容器时在 Rancher 容器上创建一个目录。我在 Rancher UI 升级命令选项卡“mkdir test_parvez”上添加了 linux 命令,但是我得到 mkdir:无法创建目录“test_parvez”:文件存在
似乎该目录已经存在。您可能想要使用该命令mkdir -p test_parvez,以便在它已经存在时不会出错。如果您需要目录为空,您可以在创建它之前将其删除:(rm -rf test_parvez && mkdir -p test_parvez这可能是首选,因为路径有可能引用文件,因此它不能将文件覆盖为目录)。
mkdir -p test_parvez
rm -rf test_parvez && mkdir -p test_parvez
另外,我强烈建议使用完整路径。您可能已经在使用完整路径,但针对此问题对其进行了简化。