File Transfers
Transfer files to and from your staging environment using SCP, rsync, or SFTP.
SCP (Secure Copy)
SCP is the simplest way to copy files.
Upload Files
# Upload a single file
scp local-file.txt [email protected]:/var/www/html/
# Upload to a specific directory
scp my-plugin.php [email protected]:/var/www/html/wp-content/plugins/
# Upload a directory (recursive)
scp -r ./my-plugin/ [email protected]:/var/www/html/wp-content/plugins/
Download Files
# Download a file
scp [email protected]:/var/www/html/wp-config.php ./
# Download a directory
scp -r [email protected]:/var/www/html/wp-content/uploads/ ./backup/
Rsync
Rsync is more efficient for syncing directories, as it only transfers changed files.
Sync Local to Remote
# Sync a plugin directory
rsync -avz ./my-plugin/ [email protected]:/var/www/html/wp-content/plugins/my-plugin/
# Sync a theme
rsync -avz ./my-theme/ [email protected]:/var/www/html/wp-content/themes/my-theme/
Sync Remote to Local
# Backup wp-content
rsync -avz [email protected]:/var/www/html/wp-content/ ./backup/wp-content/
# Backup uploads only
rsync -avz [email protected]:/var/www/html/wp-content/uploads/ ./backup/uploads/
Mirror with Delete
Destructive Operation
The --delete flag removes files from the destination that don't exist in the source.
# Mirror local theme to remote (deletes extra files on remote)
rsync -avz --delete ./my-theme/ [email protected]:/var/www/html/wp-content/themes/my-theme/
Rsync Options Explained
| Option | Description |
|---|---|
-a | Archive mode (preserves permissions, timestamps, etc.) |
-v | Verbose output |
-z | Compress during transfer |
--delete | Delete files not in source |
--dry-run | Show what would be transferred without doing it |
--exclude | Exclude files matching pattern |
Exclude Files
# Sync but exclude certain files
rsync -avz --exclude='node_modules' --exclude='.git' ./my-theme/ [email protected]:/var/www/html/wp-content/themes/my-theme/
SFTP
SFTP provides an interactive file browser.
Interactive Session
sftp [email protected]
SFTP Commands
Once connected, you can use these commands:
| Command | Description |
|---|---|
ls | List remote files |
lls | List local files |
cd | Change remote directory |
lcd | Change local directory |
pwd | Print remote working directory |
lpwd | Print local working directory |
get file | Download file |
put file | Upload file |
mkdir dir | Create remote directory |
rm file | Delete remote file |
exit | Close connection |
Example Session
sftp [email protected]
sftp> cd wp-content/plugins
sftp> ls
sftp> put my-plugin.zip
sftp> exit
GUI Clients
You can also use graphical SFTP clients:
Configure them with:
- Host:
ssh.myscalablesite.com - Port:
22 - Protocol: SFTP
- Username:
{slug}-staging - Authentication: SSH Key