Does Rsync Delete Files, Folders at Destination by Default?

Files

Suppose that /foo/src contains only A.c and that /foo/dest contains both A.c and B.c. And suppose I run the following command:

rsync /foo/src/ /foo/dest

Will rsync erase B.c?

Folders

Now suppose that /foo/src contains the directory A with some files inside it and that /foo/dest contains both directories A and B, each with some files inside of them. And suppose I run the following command (the -a option includes -r, recursive):

rsync -a /foo/src/ /foo/dest

Will rsync erase B and its contents?

1
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.