# How to keep the full path with rsync?

When using `rsync` to back up data, you can preserve the full directory structure of your source data by using the `-a` (or `--archive`) option. The `-a` option is a shorthand for several other `rsync` options, including `-r` (recursive) and `-l` (preserve symlinks), among others. It ensures that the directory structure is maintained in the destination.

Here's the basic syntax for using `rsync` to back up data while preserving the directory structure:

```bash
rsync -av source_directory/ destination_directory/
```

In this command:

- `source_directory` is the directory you want to back up.
- `destination_directory` is the location where you want to store the backup.

The `-a` option ensures that the full directory structure, along with file attributes and permissions, is preserved. The trailing slash after `source_directory/` is important; it tells `rsync` to copy the contents of the directory rather than the directory itself. This way, you'll have the contents of `source_directory` mirrored in `destination_directory`, maintaining the directory structure.

Here's a breakdown of some of the options used:

- `a` (or `-archive`): Preserves a variety of file attributes and permissions, including recursive copying and symbolic link preservation.
- `v` (or `-verbose`): Displays detailed information about the files being copied, which can be helpful for monitoring the backup process.

You can adjust the command to suit your specific needs, such as excluding certain files or directories using the `--exclude` option or specifying remote hosts for backup. The key to preserving the directory structure is to use the `-a` option, which ensures that the source directory's structure is maintained in the destination.