LFCA · Question #53
When using rsync to mirror a local directory to a remote server, what is the significance of the -- delete option?
The correct answer is D. Files present in the remote directory, but not present in the local directory, will be deleted. This question asks about the specific function of the --delete option when using rsync for mirroring directories.
Question
When using rsync to mirror a local directory to a remote server, what is the significance of the -- delete option?
Options
- AFiles absent from the remote directory will be restored from the local directory.
- BFiles present in the local directory, but not present in the remote directory, will be deleted.
- CFiles absent from the local directory will be restored from the remote directory.
- DFiles present in the remote directory, but not present in the local directory, will be deleted.
How the community answered
(40 responses)- A5% (2)
- B3% (1)
- D93% (37)
Why each option
This question asks about the specific function of the `--delete` option when using `rsync` for mirroring directories.
The `--delete` option does not restore files; it removes them from the destination if they are not in the source.
This description is inverted; `rsync` with `--delete` deletes files on the *destination* that are *not* in the source.
This describes a restoration scenario from remote to local, which is the opposite of mirroring local to remote and not what `--delete` does.
The `rsync --delete` option ensures that files existing on the destination (remote) directory but not present in the source (local) directory are removed from the destination. This makes the destination an exact mirror of the source, removing obsolete files and maintaining synchronization.
Concept tested: rsync utility options (mirroring, --delete)
Source: https://man7.org/linux/man-pages/man1/rsync.1.html
Topics
Community Discussion
No community discussion yet for this question.