cp: cannot stat : No such file or directory

10,413

You have TWO problems.

A: you're apparently are on the machine you're trying to copy to, rather than the one you're trying to copy from

B: cp cannot transfer between machines.

To resolve A try

scp [email protected]:/home/username/some.xml /path/to/directory/
Share:
10,413

Related videos on Youtube

CodeMed
Author by

CodeMed

Updated on September 18, 2022

Comments

  • CodeMed
    CodeMed almost 2 years

    I am getting an error when I try to copy a file from my local computer to a remote server. I get the same error whether I use cp or scp.

    Here is my input at the resulting error:

    [[email protected] /]# cp /home/username/some.xml [email protected]:/path/to/directory/  
    cp: cannot stat ‘/home/username/some.xml’: No such file or directory
    

    I have checked, and there is definitely a file at the path /home/username/some.xml on my local machine.

    Both the local computer and the remote server are running CentOS 7. How can I resolve this error and copy successfully?

  • CodeMed
    CodeMed over 9 years
    My cp command in my OP above was correct with two minor modifications. 1.) I had to type exit to log out as [email protected] and thus get a prompt on my local machine, and 2.) I had to change cp to scp in order to send the data to the remote web server. Since your answer pointed me in the right direction, I am accepting, it, but the solution was what I am typing in this comment. +1 for helping.