Shared server guidance · Question & answer

How do I copy a directory using SCP?

Use scp -r for a recursive directory copy. Review the source tree and destination first, because the operation can include many files and overwrite matching destination names. This is a copy, not a deployment or synchronisation policy.

BeginnerWindows 11 with Microsoft OpenSSH Client; Windows PowerShell 5.1 or PowerShell 7 as labelledLinux VPS and dedicated servers where a remote Linux command is shown
Go to the answer

Instructions

1. Inspect the source tree

Choose a narrow directory and check for private keys, environment files, credentials or unwanted generated content.

Local Windows PowerShell
Get-ChildItem -LiteralPath ".\upload-folder" -Force

This inspects the top level. Review nested contents as needed before transferring the entire directory.

2. Copy to an existing account-owned staging directory

The example expects a staging directory under the remote account’s home.

Local Windows PowerShell
scp -r ".\upload-folder" adminuser@203.0.113.10:staging/

-r recursively copies the selected directory. Confirm whether staging already exists so the resulting directory layout is predictable.

3. Check the resulting layout and data

Inspect the target before any application uses it.

Remote Linux shell
ls -la "$HOME/staging/upload-folder"

Confirm the expected contents and permissions. SCP recursion can follow symbolic links; review the source tree rather than assuming links remain links.

Check the result

  • The destination layout matches the planned staging directory.
  • Expected files are present without unintentionally included credentials or private material.

Troubleshooting

The directory nesting differs from expectations
Inspect whether the destination existed before copying; do not repeat the copy until the resulting paths are understood.
A large unexpected tree is copied
Check the selected source and symbolic links. Stop and review scope before another recursive transfer.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.