Copy a whole folder from a remote computer

7

1

I need to copy a whole folder from a remote computer. I am new to SSH and SCP.

How can I do that?

CS newbie

Posted 2012-07-16T03:52:18.353

Reputation: 79

1In the future, it'd be helpful to explain what you actually tried and what didn't work for you. That way you'll get better answers. We can't guess which pages you've already found on the internet and what exactly didn't work. Thanks! – slhck – 2012-07-16T12:25:52.533

Answers

11

Assuming the remote server supports SSH and SCP, this guide is really helpful: SCP and SFTP for Unix and Mac OS X

To copy an entire folder from a remote server,

scp user@server_address:/path/to/folder/* /home/folder/

Example where I copy a folder called stuff from example.com and put it in the folder called stuff2 in my home directory.

Using the -r flag:

scp -r CS_newbie@example.com:/stuff/ ~/stuff2/

Other way:

scp CS_newbie@example.com:/stuff/* ~/stuff2/

Sid

Posted 2012-07-16T03:52:18.353

Reputation: 224

TO CLARIFY: the -r flag copies the entire directory including all subdirectories. From- http://www.linuxquestions.org/questions/linux-general-1/useing-scp-to-copy-entire-directories-with-sub-folders-362842/

Username: spooon says ""-r" flag to copy directories (same as with "cp"; by default it only copies files not directories, "-r" makes it copy directories)"

– Daniel – 2014-07-16T18:51:16.510

0

Aside from command line options like SCP, SFTP or rsync, on Mac OS X you can also just use File Sharing by enabling it from System Preferences. Your computer will then show up on other Apple computers which have Bonjour enabled and you can drag & drop your files across. See Apple's docs at: Mac 101: File Sharing

You can also use a GUI client such as FileZilla as an FTP client / server. You can download this here: http://filezilla-project.org/ This works well even for very large transfers where the connection is liable to drop as you can re-queue those files much more easily than on the command line.

funkotron

Posted 2012-07-16T03:52:18.353

Reputation: 111