9951 explained code solutions for 126 technologies


scpHow to SCP a directory?


SCP (Secure Copy Protocol) is a secure way to transfer files between two computers. To SCP a directory, you can use the following command:

scp -r <source_directory> <username>@<hostname>:<destination_directory>

This command will copy the <source_directory> to the <destination_directory> on the remote host <hostname> as the user <username>.

Code explanation

  • scp: the command to initiate the SCP process
  • -r: the flag to indicate that the source is a directory
  • <source_directory>: the directory to be copied
  • <username>: the username of the remote host
  • <hostname>: the hostname of the remote host
  • <destination_directory>: the directory on the remote host where the source directory will be copied to

Helpful links

Edit this code on GitHub