Search code examples
file-transferscp

Problems upolading files from local to server using scp


I'm having problems in uploading some folders from the local machine to a server. When I run the command

scp -r -i pathtokey.txt pathtomyfiles pathtotheserver

For some folders the transfer doesn't succed. I noticed that this happens for the folders where I have R projects. It transfers just usually hidden files named as "source-pane.pper" "chunks.json", but nothing else.

For other folders, where I don't have any of that, the transfer goes fine, meaning that the command I'm using is ok. Any suggestion of what is happening here and how to solve?

Just to give you all the information, my local machine has windows system

Thanks a lot, Francesca


Solution

  • I'm unsure why this is failing unfortunately. However an alternative may be to look at using rsync:

    rsync <options> <source> <destination>
    rsync -azv source_dir/ username@server:~/path/to/folder
    

    I've not tried this while specifying an ssh key explicitly but the answer below explains how to do so. Alternatively you can just type in the password manually if you know it.

    https://unix.stackexchange.com/questions/127352/specify-identity-file-id-rsa-with-rsync