# How to restore backup with RSync

[https://askubuntu.com/questions/1011136/how-to-restore-backup-with-rsync](https://askubuntu.com/questions/1011136/how-to-restore-backup-with-rsync)

asically just revierse the order for the backup.   
-tag it `rsync -aAXv`  
Then start from backup directory and end with destination directory

```bash
sudo rsync -aAXv --delete /mounted/backups/cpbackups/ /mounted/main/directory/location/
```

+from Backtup= /mounted/backups/cpbackups   
+To Destination= /mounted/main/directory/location?

\*NOTE "/"\*  
The "/" means something!  
At the end of the directory, if you do not include the "/" Rsync will make a directory inside the directory you specify, then will include the files in from there.  
If you DO include the "/", it will drop the files/directories in, directly at the directory that you specify.

Example:

```bash
sudo rsync -aAXv --delete
```

   
((1)) /mounted/backups/cpbackups  
((2)) /mounted/main/directory/location?

Without "/"  
((1)) File name will be "cpbackups" and will make a directory named "cpbackups" and put it in ((2)).

With "/"  
Will take files from INSIDE ((1)) and put them INSIDE the ((2)) directory.

\*\*Change the flags\*\*

```bash
rsync -aHAXvP /home_folder_path /backup_folder_path
```