# rsync - how can I delete files at the destination that are deleted at the source?



## mariourk (Mar 15, 2013)

I'm using rsync to copy a load of files to a new server. Before actually migrating, I want to run rsync one last time, to make sure I have all the files and the latest versions. However, if a file got deleted on the source, after the previous rsync run, it won't get deleted on the destination, when running one last rsync.


```
* rsync syncs files A, B and C
* user modifies B, deletes C and adds D
* rsync will sync files B and D, but does not delete C at the destination
```

Does rsync have an option to fix this? If so, how?


----------



## wblock@ (Mar 15, 2013)

rsync(1) describes the --delete option.


----------



## mariourk (Mar 15, 2013)

Ah, that is ideed what I was looking for. Thanks! :beer


----------



## jb_fvwm2 (Mar 16, 2013)

```
# here # rsync -vaH --delete-delay . /there
```
[Note the dot denoting the "here" directory].
If you encounter any incompletion of the command as you run it, you may wish to use the above delete parameter which may fix it...


----------

