Fwd: [3.1.3] --remove-source-files $SRC/ $SRC/ - erases all files

Kevin Korb kmk at sanitarium.net
Tue Oct 18 11:51:51 UTC 2022


Rsync does not have a --no-clobber.  -n is --dry-run.  It shows what 
rsync would do without actually doing it.  But I didn't know you were 
using --backup.  Anyway, I tried it again with --backup and 
--remove-source-files and it did in fact delete all the files (but not 
the dirs).  It didn't have any output indicating such so it seems like a 
problem to me.  BTW, it isn't the --backup either.  Just the 
--remove-source-files is enough I just didn't know it because it isn't 
in the output so --dry-run gives no clue.

On 10/17/22 23:51, Sridhar Sarnobat wrote:
>     I think I must be missing something.  If source and dest are the same
>     place rsync shouldn't do anything unless it it responding to changes
>     happening at the same time.  For example, when I do 'rsync -vain
>     --remove-source-files /tmp/ /tmp/' rsync does nothing.
> 
> 
> Thanks for the response. You are using "-n" / "--no-clobber".
> 
> In my case I'm using "-b" / "--backup" (or overwrite). My use case is to 
> get everything out of the source location, and "--no-clobber" will leave 
> things behind. So I guess I should refine my issue to "when you're not 
> using --no-clobber."
> 
> Do I have a case here? Or is this erasing both the source and 
> destination a valid behaviour in my case?

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			https://sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,



More information about the rsync mailing list