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 :/home/bleble/.bash_profile

I get:

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

I know it's not a directory.

What am I doing wrong?

1

2 Answers

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 :/home/bleble/

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.

3

For what it's worth, I got this error when mixing up the order of the arguments, i.e. I typed

scp selnpcgwnx1001:~ file1 file2

instead of the correct

scp file1 file2 selnpcgwnx1001:~

For some reason I thought that the fact that you can provide multiple files as arguments meant that those arguments have to be placed last. Wrong, you can have multiple files as arguments and then have the target folder as the last argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest