【问题标题】:cp: cannot stat 'grandchildren': No such file or directory [closed]cp:无法统计“孙子”:没有这样的文件或目录[关闭]
【发布时间】:2017-10-22 12:26:21
【问题描述】:

我正在尝试将孙子目录复制并重命名为父目录,它反复给我这个错误:

brad@brad-Inspiron-5558: ~/cli-tmp/parents/children/grandchildren$ cp -r grandchildren ../nephews


cp: cannot stat 'grandchildren': No such file or directory

brad@brad-Inspiron-5558: ~/cli-tmp/parents/children/grandchildren$ cp -r grandchildren ../nephews

cp: cannot stat 'grandchildren': No such file or directory

我做错了什么?

【问题讨论】:

  • 这和r有什么关系?另外,你在grandchildren,我猜grandchildren/grandchildren 不存在。要么上一个目录,要么从.复制。
  • r 是我无意中点击的建议标签。 bradmason1990:~/cli-tmp/parents $ cp -r grandchildren ../newphews cp: cannot stat 'grandchildren': No such file or directory bradmason1990:~/cli-tmp/parents $ 是我尝试从更高的目录,仍然无法执行它

标签: ubuntu terminal cp


【解决方案1】:

假设您要将~/cli-tmp/parents/children/grandchildren 复制到~/cli-tmp/parents/children/nephews,并且它们都存在,那么您可以只使用完整路径cp 或:

cd ~/cli-tmp/parents/children
cp -r grandchildren nephews

如果您想从 grandchildren 中复制,如您的示例所示,那么:

cp -r . ../nephews

. 这里是当前目录,.. 是父目录。

请注意,我假设 grandchildren 存在于 children 中。你的失败是因为你实际上复制了不存在的~/cli-tmp/parents/children/grandchildren/grandchildren

【讨论】:

  • 它是练习的一部分,它要求我将孙子目录复制到父母目录。我移到 /children,它让我运行 cp,但它没有将其复制到父目录,而是现在在子目录中
  • 然后直接复制到..
  • 我相信我做到了。我不熟悉以这种方式使用终端,所以我读错了树,我只需要移动到 /children 并从那里复制并重命名它。谢谢
猜你喜欢
  • 1970-01-01
  • 2022-07-06
  • 2021-12-27
  • 2016-04-11
  • 2017-11-29
  • 1970-01-01
  • 2016-01-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多