> ## Documentation Index
> Fetch the complete documentation index at: https://docs.directgvr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Copy releases between servers or CDNs

> Use release_copy.py or repository_sync.py to move releases and repositories from one server or CDN to another.

After you [deploy releases](https://docs.directgvr.com/release-automation/deploy-a-release.md), you can copy them to another server or CDN. Use `release_copy.py` to copy one release, or `repository_sync.py` to copy whole repositories.

## Choose a script

Use [release\_copy.py](https://docs.directgvr.com/release-automation/deployment-scripts.md#release_copy-py) if:

* You only need to copy one release.
* You need to change the release's delivery URL, for example from an internal server to your CDN.

> [!NOTE]
>
> `release_copy.py` doesn't copy alias files, so environment assignments aren't copied. Promote releases on the new server separately. See [Create environments and promote releases](https://docs.directgvr.com/release-automation/environments-and-promotion.md).

Use [repository\_sync.py](https://docs.directgvr.com/release-automation/deployment-scripts.md#repository_sync-py) if:

* You need to copy every repository, or a whole repository including its alias files, to the target.
* You don't need to change the delivery URL.
* You want the target to match the source exactly. The script deletes target files that aren't in the source, and can overwrite files.

## Copy a release

Set these arguments on the command line, in a JSON configuration file or both:

* `repository`: the repository the release belongs to, such as `gameclient`.
* `source`: full path to the folder that contains the repository. Use the `sync_directory` you deployed to.
* `target`: full path to copy to. Like `sync_directory`, this can be a local path, an S3 bucket or a CDN path in a supported protocol.
* `base_url`: the delivery URL the launcher downloads from on the target, for example `http://mycdn.net/mydirectory/`.

Choose the release with one of:

* `version`: the release version, such as `0.0.1`.
* `description`: the description you used when deploying.
* `release_id`: the release's unique SHA1 ID.

You can find these values in `tracker.json` or the repository's `history.json` file.

This example copies release `1.0` of the `gametime` repository from Akamai NetStorage to an S3 bucket:

```json copy_ns_to_s3.json theme={null}
{
  "repository": "gametime",
  "base_url": "https://<target-delivery-host>/<path>/",
  "source": "ns://<your-upload-host>.akamaihd.net/<cp-code>/<path>/",
  "target": "s3://<bucket>/<path>/",
  "version": "1.0"
}
```

```bash theme={null}
release_copy.py --config=c:\path\to\config\copy_ns_to_s3.json
```

For each release, the script copies:

* Every piece for the release
* The catalog file for the release and its update paths, with the new `base_url`
* Delta paths to this release
* Index files for source releases to this release
* The release's metafile
* `repositoryname.history.json` with this release's information

## Sync repositories

Required arguments:

* `source_sync_directory`: full path to the folder with your repositories. Use the `sync_directory` you deployed to.
* `target_sync_directory`: full path to copy to.

Optional arguments:

* `repository`: the repository to sync. Without it, every repository in the source is copied.
* `dry_run`: show the number and size of files to copy or delete without syncing.
* `overwrite`: copy files even if they already exist and match. Without it, existing files are skipped.

You can find the sync directory and repository values in `tracker.json`.

```json sync_ns_to_s3.json theme={null}
{
  "repository": "gametime",
  "source_sync_directory": "ns://<your-upload-host>.akamaihd.net/<cp-code>/<path>/",
  "target_sync_directory": "s3://<bucket>/<path>/"
}
```

```bash theme={null}
repository_sync.py --config=..\samples\config\sync_ns_to_s3.json
```

> [!WARNING]
>
> `repository_sync.py` deletes files in the target folder that aren't in the source folder. Existing files aren't overwritten unless you use `overwrite`.

## Related

* [Deploy a release](https://docs.directgvr.com/release-automation/deploy-a-release.md)
* [Configure the scripts for your server or CDN](https://docs.directgvr.com/release-automation/configure-server-or-cdn.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.