How to Transfer and Backup Website Files with Rsync Carrie SmahaUpdated on July 28, 2026 4 Minute Read Rsync is one of the most reliable tools for moving website files between servers, from your computer to a host, or for creating clean backups. Unlike FTP clients, it only transfers changed data (delta transfers), preserves permissions and timestamps, and can keep source and destination in sync. This makes it ideal for migrating sites, deploying updates, or backing up production files with minimal downtime and bandwidth use. This guide focuses on the most common needs of webmasters and site owners who have SSH access to their servers (cPanel, VPS, or unmanaged hosting). Prerequisites SSH access to the source and/or destination server (username + hostname or IP). The rsync binary available on both ends (almost all modern Linux servers include it). Enough disk space on the destination. Basic familiarity with the terminal. Always test with the --dry-run (or -n) option first so you can see what would happen without making changes. Basic Rsync Syntax rsync [options] source destination Source and destination can be local paths or remote (user@host:/path). A trailing slash on the source directory matters: /path/to/site/ copies the contents. /path/to/site copies the directory itself. 1. Transfer Website Files from Your Local Computer to a Remote Server Useful when you develop locally or have a full site backup on your machine and need to push it live. rsync -avz --delete --progress /path/to/local/website/ [email protected]:/home/username/public_html/ What the options do: -a – archive mode (recursive, preserves permissions, ownership, timestamps, symlinks). -v – verbose (shows what is happening). -z – compress data during transfer (helpful over slower connections). --delete – removes files on the destination that no longer exist on the source (keeps the two locations identical). Use with caution. --progress – shows transfer progress. Example for HTML/static files only: rsync -avz --delete --include='*.html' --include='*/' --exclude='*' /local/site/ user@server:/var/www/html/ 2. Pull Website Files from a Remote Server to Your Local Machine (Backup or Migration Prep) rsync -avz --delete --progress [email protected]:/home/username/public_html/ /path/to/local/backup/ This is an excellent way to create a local mirror of your live site before making major changes or before switching hosts. 3. Transfer a Site Directly Between Two Remote Servers You can run the command from either server (or from your local machine if it has SSH access to both). From the destination server: rsync -avz --delete --progress [email protected]:/home/username/public_html/ /home/username/public_html/ Or use SSH key authentication and run it from your laptop so neither server needs the other’s password: rsync -avz -e ssh --delete user@oldserver:/path/to/site/ user@newserver:/path/to/site/ Important Options for Webmasters OptionPurposeWhen To Use It-a / --archivePreserve permissions, ownership, timesAlmost always for websites-zCompress during transferSlower connections or large files--deleteMake destination match source exactlyFull migrations / clean syncs--exclude='dir/'Skip specific foldersExclude node_modules, .git, caches, uploads if needed--dry-run / -nSimulate the transferAlways test first--progressShow file-by-file progressLarge transfers-e sshForce SSH transportWhen needed for security or non-standard ports Common exclusions for WordPress or similar CMS sites: rsync -avz --delete \ --exclude='wp-content/cache/' \ --exclude='wp-content/uploads/' \ # optional – sometimes you want media separately --exclude='.git/' \ --exclude='node_modules/' \ user@old:/path/to/site/ user@new:/path/to/site/ Why Prefer Rsync Over FTP/SFTP Clients for Site Transfers? Delta Transfers: After the first full copy, only changed files (or even parts of files) are sent. Subsequent updates are dramatically faster. Permission Preservation: Critical for PHP apps, WordPress, and scripts that rely on correct ownership. Scriptable & Schedulable: Put the command in a shell script and run it via cron for automated backups or deployments. Reliable Over Imperfect Connections: Rsync can resume interrupted transfers more gracefully than many GUI tools. Safety Tips Always run with --dry-run first and review the output. Be careful with --delete because it will permanently remove files on the destination. Prefer SSH keys over passwords for automation. After a full site transfer, update configuration files (database credentials, domain paths, etc.) and clear any caches. For very large media libraries, consider transferring the database and application files first, then media in a second pass (or use a tool specialized for large binary data). Quick Reference Commands Push local site live (with dry-run first): rsync -avzn --delete /local/site/ user@server:~/public_html/ # then remove the n to actually run it Pull live site for backup: rsync -avz --delete user@server:~/public_html/ ~/backups/mysite-$(date +%Y%m%d)/ Full remote-to-remote migration: rsync -avz --delete -e ssh user@oldserver:~/public_html/ user@newserver:~/public_html/ Rsync is already installed on the vast majority of Linux hosting environments. Once you are comfortable with the basic options above, you can handle almost any site transfer or backup task efficiently and cleanly from the command line. Summarize and Research with AIShare on Social Media Carrie Smaha Senior Manager Marketing Operations Carrie Smaha is a digital strategy, web development, and SEO leader with 20 years of experience. She built her foundation in fast-paced agency environments before moving in-house to InMotion Hosting, where she leads go-to-market programs, agency initiatives, and technical product marketing that connects product capability to real customer decisions. More Articles by Carrie Related Articles How to Transfer and Backup Website Files with Rsync Intro to Migrating your WordPress Site Data Migrating your WordPress Database Migrating WordPress Files Configuring WordPress After a Migration Testing your WordPress website after Migration How to Move WordPress from a Subfolder to the Root Directory What to expect during a mass server migration Move Your WordPress Site to a New Server Moving Websites Built with Older Technology into WordPress