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.

2 Answers 2

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/

1
  • 1
    worked perfectly, thanks for the quick response
    – zombiedad
    Oct 4, 2013 at 22:18
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 [email protected]:/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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .