cp:无法统计`/vol/examples/tutorial/science.txt':没有那个文件或目录

bas*_*boy 18 bash filenames

我尝试了一个命令cp /vol/examples/tutorial/science.txt .,但出现错误 -

cp: cannot stat `/vol/examples/tutorial/science.txt': No such file or directory
Run Code Online (Sandbox Code Playgroud)

我不明白为什么会这样。我去了 cygwin 主文件夹并创建了必要的文件夹结构和文本文件。我还检查了文件夹结构和名称。

另外,我进入~/vol/examples/tutorial然后做cat science.txt,我可以阅读文档。那么为什么 CP 命令不起作用呢?

Bit*_*Nix 12

这样做你就会明白:

cd ~/vol/examples/tutorial 
pwd
Run Code Online (Sandbox Code Playgroud)

最有可能的PWD的结果不仅仅是/vol/examples/tutorial/home/username/vol/examples/tutorial

~ 替换为用户主目录,通常甚至在 cygiwn /home 下。

  • 因为当你使用 cp /vol 与 cp ~/vol 不同。将您的 cp 命令更改为 cp ~/vol/ 以工作。这不是问题,您提供的是不同的路径 (5认同)