Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SCP not recognizing destination file path

I want to copy my environment files in the dir .env/ from my local machine to my remote machine.

According to this answer, I tried the following but got an error:

stephen@desktop:~/Projects/finance$ scp -r .env root@<MY_IP_INSTANCE>:/finance
scp: /finance/.env: Not a directory

I verified the directory exists on my local machine:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

stephen@desktop:~/Projects/finance$ ls -al | grep .env
drwxrwxr-x  2 stephen stephen      4096 Nov 12 14:25 .env

And I verified it does not exist on my remote machine:

root@localhost:~/finance# ls -al |grep .env
root@localhost:~/finance#

According to the online resources, the source path should remove the trailing / from the file path if I want to copy the entire folder. I’ve hit insanity where I’ve tried every combination of source and destination paths.

EDIT:
Here is the linode docs which is the VPS I am using. Seems like conflicting information.

EDIT2: Here is what worked

stephen@desktop:~/Projects/finance$ scp -r .env root@173.255.210.31:finance
.dev.local    100%  712    20.0KB/s   00:00    
.prod         100%  595    21.2KB/s   00:00     
.prod.local   100%  710    24.7KB/s   00:00     
.dev          100%  597    20.2KB/s   00:00 

>Solution :

You need to remove the slash. What you wrote refers to the root folder on the other machine. From your verification steps it’s clear though that you meant the home folder of root (/root):

scp -r .env root@<MY_IP_INSTANCE>:finance
# or, explicitly
scp -r .env root@<MY_IP_INSTANCE>:/root/finance
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading