# Do A Dry Run Of An rsync

The `rsync` command, especially when running recursively (with the `-a` flag), will create and update a bunch of directories and files. Because of that, you may want to do a *dry run* of an `rsync` command to make sure it is touching the intended files.

The `--dry-run` flag (or the `-n` flag for short) will prepare a synchronization of one directory to another. You can use this flag to be sure that the source and target files and directories are correct.

The `-n` (or `--dry-run`) flag on its own won't *show* what is going to get synced. To get that information, you need to combine it with the `-v` (verbose) flag.

```bash
$ rsync -anv til-temp/ til-content

building file list ... done
./
LICENSE
...

sent 909 bytes  received 296 bytes  2410.00 bytes/sec
total size is 1058  speedup is 0.88
```

That will show everything that is going to be synced from `til-temp/` recursively to `til-content`.

Doing a dry run is a great way to make sure you have the patterns for `--exclude` flags correct, before actually syncing anything.

```bash
$ rsync -anv --exclude='./*.md' --exclude='.*' til-temp/ til-content
```

That excludes top-level markdown files and all dotfiles and dot-directories.

[source](https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/os/unix/process/do-a-dry-run-of-an-rsync.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
