# How to Sync Game Server Files to Your PC Automatically (SFTP)

Keep a copy of your hosted world on your own PC with a WinSCP script and Task Scheduler on Windows, or rclone on Mac and Linux. Step by step, with dated copies.

Updated 2026-10-07. https://gamezservers.com/guides/how-to-sync-game-server-files-to-your-pc

You can keep an automatic copy of a hosted game server on your own PC by running an SFTP sync on a schedule: on Windows, a small WinSCP script started by Task Scheduler, and on Mac or Linux, rclone started by cron. The script connects with your server's SFTP login, downloads only files that changed, and saves them to a dated folder. Set it up once and you always have a copy of your world that does not depend on your host.

## Why bother when the host makes backups

Host backups protect you from a corrupted save or a bad mod. A copy on your own drive also protects you from losing access to the host: a lapsed payment, a closed account, or the host itself going away. It is also the copy you take with you if you ever [move to a new host](https://gamezservers.com/guides/how-to-move-a-game-server-to-a-new-host).

## Before you start

You need:

- Your server's **SFTP host, port, username and password** from the control panel.
- The **folder that holds your world**. Syncing only that folder is faster than the whole server. [How to download your world from a game server](https://gamezservers.com/guides/how-to-download-your-world-from-a-game-server) lists it for each game.
- Enough free disk space for a few copies.

Common world folders:

| Game | Folder to sync |
| --- | --- |
| Minecraft Java | world, world_nether, world_the_end (or the level-name from server.properties) |
| Valheim | The worlds_local folder inside the server's save path |
| Terraria | The Worlds folder |
| Palworld | Pal/Saved/SaveGames |
| Project Zomboid | Zomboid/Saves/Multiplayer and Zomboid/Server |
| ARK: Survival Ascended | ShooterGame/Saved |
| 7 Days to Die | The Saves folder |

## Windows: WinSCP and Task Scheduler

### Step 1: install WinSCP

Download it from the official site, [winscp.net](https://winscp.net/), and install. It includes `WinSCP.com`, the command line version used below.

### Step 2: connect once by hand

Open WinSCP, choose SFTP, enter the host, port, username and password, and connect. Accept the server's host key when asked. This confirms the login works and lets you browse to the exact path of your world folder. Write that path down, for example `/world`.

While connected, use **Session**, **Generate Session URL/Code**, then the **Script** tab. WinSCP shows an `open` command with the correct host key filled in. Copy it.

### Step 3: write the scripts

Create a folder like `C:\GameBackups`. First save the WinSCP part as `C:\GameBackups\sync.txt`. Replace the `open` line with the one WinSCP generated, and `/world` with your world path:

```
open sftp://USERNAME:PASSWORD@HOST:PORT/ -hostkey="ssh-ed25519 255 xxxxxxxx"
synchronize local "C:\GameBackups\minecraft\latest" /world
exit
```

`synchronize local` downloads from the server folder (`/world`) into the local `latest` folder, copying only what is new or changed, so after the first run it is quick.

Then save this as `C:\GameBackups\sync.ps1`. It runs the sync and keeps a dated snapshot of the result:

```powershell
New-Item -ItemType Directory -Force -Path "C:\GameBackups\minecraft\latest" | Out-Null
& "C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\GameBackups\sync.txt" /log="C:\GameBackups\sync.log"
if ($LASTEXITCODE -eq 0) {
  $date = Get-Date -Format "yyyy-MM-dd"
  Copy-Item "C:\GameBackups\minecraft\latest" "C:\GameBackups\minecraft\$date" -Recurse -Force
}
```

If WinSCP is installed somewhere else, adjust the path. On some installs it is `C:\Program Files\WinSCP\WinSCP.com`.

### Step 4: test it

Open PowerShell and run:

```
powershell -ExecutionPolicy Bypass -File C:\GameBackups\sync.ps1
```

Check that the `latest` folder and a folder with today's date fill with your world files. If it fails, read `C:\GameBackups\sync.log`; it shows the exact error, such as a wrong password or path.

### Step 5: schedule it

1. Open **Task Scheduler** and choose **Create Basic Task**.
2. Name it "Game server sync".
3. Pick **Daily** and a time when the server is quiet, like 5 AM.
4. Choose **Start a program**.
5. Program: `powershell.exe`
6. Arguments: `-ExecutionPolicy Bypass -File C:\GameBackups\sync.ps1`
7. Finish, then right click the task, **Properties**, and tick **Run whether user is logged on or not** if you want it to run without you signed in.

### Step 6: clean up old copies

Add these lines to the end of the script to keep only the last 14 days:

```powershell
Get-ChildItem "C:\GameBackups\minecraft" -Directory |
  Where-Object { $_.Name -ne "latest" -and $_.CreationTime -lt (Get-Date).AddDays(-14) } |
  Remove-Item -Recurse -Force
```

## Mac and Linux: rclone and cron

### Step 1: install rclone

Follow the instructions at [rclone.org](https://rclone.org/install/). On a Mac with Homebrew, `brew install rclone` works.

### Step 2: add your server as a remote

```
rclone config
```

Choose `n` for a new remote, name it `gameserver`, pick `sftp`, then enter the host, user, port and password when asked. Leave the rest at defaults.

Test it:

```
rclone lsd gameserver:/
```

### Step 3: write the sync script

Save as `~/gamebackup.sh`:

```bash
#!/bin/bash
DATE=$(date +%F)
rclone copy gameserver:/world "$HOME/GameBackups/minecraft/$DATE" --log-file "$HOME/GameBackups/sync.log"
find "$HOME/GameBackups/minecraft" -mindepth 1 -maxdepth 1 -type d -mtime +14 -exec rm -rf {} +
```

Make it executable with `chmod +x ~/gamebackup.sh`.

### Step 4: schedule with cron

Run `crontab -e` and add:

```
0 5 * * * /bin/bash $HOME/gamebackup.sh
```

That runs it every day at 5 AM.

## Getting a clean copy

Copying a world while the server writes to it can catch a file halfway through a save. To reduce that:

- Schedule the sync for a quiet hour.
- In Minecraft, many groups run `save-all` before the sync, or use the host's backup feature right before.
- Keep several dated copies, so one bad copy is not the only one.
- Now and then, test a copy by loading it in single player or on a test server.

## Keep your login safe

The script contains your SFTP password in plain text. Keep the folder private, do not share it, and do not commit it to a public repository. If the password leaks, change it in your control panel and update the script.

## With GamezServers

Open **Settings** and click **Show FTP login** to see the host, port, username and password for your script. Note that every time you click it, a new password is set and the old one stops working, so after you show it again, update the password in your script or rclone config. You also have one click backups stored off the server in the panel, and the Files tab lets you download any folder as a zip whenever you want a quick manual copy. See [what SFTP is for game servers](https://gamezservers.com/guides/what-is-sftp-for-game-servers) if you are new to it, or [start a server](https://gamezservers.com/games).

![A Terraria world with a player base above ground](https://gamezservers.com/games/terraria/shot-2.jpg)

## FAQ

### Can I back up my hosted game server to my PC automatically?

Yes. Any host with SFTP lets you run a scheduled sync from your PC with WinSCP on Windows or rclone on Mac and Linux.

### Is it safe to copy a world while the server is running?

Usually, but a copy can catch a file mid save. Sync at a quiet time, keep several dated copies, and test one occasionally.

### Why did my sync suddenly fail to log in?

The SFTP password changed. On some hosts, viewing the login again sets a new password. Update the script with the new one.

### Can I sync to Google Drive or OneDrive instead?

Yes. Point the local folder at a folder your cloud drive syncs, or use rclone, which can copy from the SFTP remote straight to most cloud drives.
