为什么复制命令在使用文件路径时不起作用?
Why copy command is not working when using file paths?
我的复制命令有问题。
cp ../teste/env/test/x.tar ../../../teste2/file
文件夹和文件 x.tar 存在。当我启动脚本时,我在不同的文件夹中,所以这就是为什么我在开头制作 ../
。
它一直给我这个错误:cp: cannot create regular file ‘../../../teste2/file’: No such file or directory
值得注意的是,teste 和 teste2 文件夹都在同一个目录下。
这是文件夹 teste 树:teste tree
这是文件夹 test2 树:teste2 tree
非常感谢您的帮助!
根据您的评论,我尝试重建您可能拥有的文件树。我认为以下调用可能有效。您只是错误地计算了相对路径。
cp ../teste/env/test/x.tar ../teste2/file
相对路径始终根据当前工作目录计算得出,即您从中调用命令的文件夹。
我的复制命令有问题。
cp ../teste/env/test/x.tar ../../../teste2/file
文件夹和文件 x.tar 存在。当我启动脚本时,我在不同的文件夹中,所以这就是为什么我在开头制作 ../
。
它一直给我这个错误:cp: cannot create regular file ‘../../../teste2/file’: No such file or directory
值得注意的是,teste 和 teste2 文件夹都在同一个目录下。
这是文件夹 teste 树:teste tree
这是文件夹 test2 树:teste2 tree
非常感谢您的帮助!
根据您的评论,我尝试重建您可能拥有的文件树。我认为以下调用可能有效。您只是错误地计算了相对路径。
cp ../teste/env/test/x.tar ../teste2/file
相对路径始终根据当前工作目录计算得出,即您从中调用命令的文件夹。