Linux – SCP – “not a directory” – What am I doing wrong


On my remote server I have a file named .bash_profile, that file has nothing inside.
I wish to copy a local copy (with something inside) to the remote destination. (overwrite)

So I do:

scp ~/path/bla/ble/.bash_profile

I get:

scp: /home/bleble/.bash_profile: Not a directory

I know it's not a directory.

What am I doing wrong?

Best Answer

Since you want to copy the file with the same name, you don't need to specify a target name:

scp ~/path/bla/ble/.bash_profile

Because a .bash_profile exists in the target directory, scp thinks you are giving it a directory as a target, attempts to descend into to it and exits since it is not actually a directory.

Related Question