copy folder from local to server ssh code example

Example 1: ssh copy folder from local to remote

scp -ra /path/to/local/storage [email protected]:/path/to/copy

Example 2: how to copy directory to a ssh server

# Copy from machine a to b
scp -r /path/to/directory user@ipaddress:/path/to/destination

# Copy from machine b to a
scp -r user@ipaddress:/path/to/destination /path/to/directory

Example 3: ssh copy folder from local to remote

scp -r -P xxxx /path/of/your/local/folder username@hostname:/path/to/remote/server/folder

Example 4: ssh copy folder from local to remote

scp username@hostname:/path/of/remote/server/filename /path/to/local/destination/folder