Step1
The Sharing System Preference
WARNING: Coping files or folders to another system will destroy files and folders of the same name on the remote system if they already exist.
Make sure that the remote Mac that you want to copy data to has 'Remote Login' enabled for your account on that machine. You can do that in the 'Sharing' System Preference by checking the 'Remote Login' service. You may need to unlock the padlock at the bottom left of the 'Sharing' System Preference to make changes.
Note that your 'Sharing' preference pane may look different than the screenshot; however, the steps you need to take should be similar.
Step2
Test data folder structure
Next, if you don't already have test files to copy to the remote machine just create a 'test.txt' file and a 'test' folder with some junk data inside it on your local Mac's Desktop.
Step3
To copy the file test.txt to a remote machine called servername.example.com, launch Terminal and type the command appropriate to your version of MacOS X.
On MacOS X 10.4 or later
/usr/bin/scp -Ep ~/Desktop/test.txt username_on_remote_machine@servername.example.com:/Users/username_on_remote_machine/Desktop/
MacOS versions prior to 10.4
/usr/bin/scp -p ~/Desktop/test.txt username_on_remote_machine@servername.example.com:/Users/username_on_remote_machine/Desktop/
Just switch your remote server's hostname or IP address with servername.example.com, and your remote user account name for username_on_remote_machine'.
The only difference is that the top command has an '-E' option, which is described below.
Step4
/usr/bin/scp is the secure copy program on your computer. You pass options to the program with the dash '-' character. The 'E' option saves things like resource forks that can be important to Mac file systems. The 'p' option saves things like modification and access times for the file(s).
The next section of the command '~/Desktop/test.txt' is the local path to the file you want to copied to the remote machine.
The final section 'username_on_remote_machine@servername.example.com:/Users/username_on_remote_machine/Desktop/' is the account information used to connect to the remote machine, the remote machine's hostname and finally the destination path to the location where you want to copy test.txt to. The account 'username_on_remote_machine' must have the correct permission to write to the destination path or you will get errors.
The first time you connect to a server via scp, you will get prompted with a message similar to this: "Warning: Permanently added the RSA host key for IP address 'the remote Mac's IP Address' to the list of known hosts". This is okay. Then type the password for the 'username_on_remote_machine' account and you will see a progress indicator as the files are copied to the remote machine.
Step5
To copy an entire folder and everything inside it to the remote machine, type the following command appropriate to your version of MacOS X:
On MacOS X 10.4 or later
/usr/bin/scp -Epr Desktop/test/ username_on_remote_machine@servername.example.com:/Users/username_on_remote_machine/Desktop/
MacOS versions prior to 10.4
/usr/bin/scp -pr Desktop/test/ username_on_remote_machine@servername.example.com:/Users/username_on_remote_machine/Desktop/
Step6
Instead of a path to a file, this command includes a path to a folder. The only other addition is the 'r' option. This tells scp to copy the entire 'test' folder to the remote system.
Run the command, type the password for the 'username_on_remote_machine' account and you will see another progress indicator as the files and folders are copied to the remote machine.
Please comment and rate this article. Thanks for reading!