nerdexam
Linux_Foundation

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.

Submitted by joshua94· May 4, 2026Linux Fundamentals

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)
  • A
    5% (2)
  • B
    3% (1)
  • D
    93% (37)

Why each option

This question asks about the specific function of the `--delete` option when using `rsync` for mirroring directories.

AFiles absent from the remote directory will be restored from the local directory.

The `--delete` option does not restore files; it removes them from the destination if they are not in the source.

BFiles present in the local directory, but not present in the remote directory, will be deleted.

This description is inverted; `rsync` with `--delete` deletes files on the *destination* that are *not* in the source.

CFiles absent from the local directory will be restored from the remote directory.

This describes a restoration scenario from remote to local, which is the opposite of mirroring local to remote and not what `--delete` does.

DFiles present in the remote directory, but not present in the local directory, will be deleted.Correct

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

#rsync#file synchronization#command line utility

Community Discussion

No community discussion yet for this question.

Full LFCA Practice