Does rsync delete unmatched files by default?
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Tue Jan 4 15:32:57 UTC 2011
On Mon, Jan 03, 2011 at 10:12:20PM -0500, Kevin Cozens wrote:
> I haven't used rsync very often but my observation is that it copies
> changed/new files *before* it does the deletion. Normally, this is fine
> but if the target drive does not have a lot of spare space on it you run
> the risk of filling the target drive when rsync copies the changed/new
> files before it gets around to deleting files that no longer exist on the
> source drive.
Actually it often deletes first (or along the way), at least in newer
rsync versions. --delete-after explicitly makes it only delete when
all other stuff is done. Without that option, it makes no promises
about when it will do deletes.
Essentially, --delete means --delete-during on rsync version 3 (when
both ends is version 3), since it does incremental file list transfers.
Older versions always sent the full file list first before doing anything
else (which was a lot less efficient), and on those --delete meant
--delete-before, so it always deleted fiels first. If you want the
old behaviour back, use --delete-before, but you loose the advantages of
incremental file list transfers. If transfering locally to an external
disk, that is probably not a problem.
--
Len Sorensen
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list