11

I am trying to get some files off of my school Linux account using ssh. I have got the connection to work using:

scp <school_server>: ~/folder I want ~/where I want to go.

But when it goes to transfer folder it gives me the message:

not a regular file

The file contains .java files, and I want the whole folder.

zombiedad
  • 125

2 Answers2

23

To recursively copy a whole directory using scp, you need to add the -r switch

scp -r remotehost:/path/to/remote/dir/ /path/to/local/dir/
steeldriver
  • 136,215
  • 21
  • 243
  • 336
1

I have destination that needs PEM to connect and it also has different SSH port. This worked for me like charm:

For e.g. Copy folder (and subfolders) from sourceserver to targetserver, run this on sourceserver

$ rsync -azu -e 'ssh -i ./pem_for_target_server.pem -p <port_number_for_target_server>' /folder/path/on/source username_on_target@target.server.name:/path/on/target/where/you/want/to/copy/folder/on/source/

(In case you get permissions are too open for pem file, run this: chmod 400 ./pem_for_target_server.pem)

Atul
  • 161
  • 6