rsync --delete

Kevin Korb kmk at sanitarium.net
Thu Apr 16 09:43:24 MDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I thought of something else if it must be rsync that is used...

rsync -a --delete --exclude='*' --delete-excluded /anywhere/
/stuff/to/delete/

That would empty the target dir regardless of what is in the source dir.

I would still like to hear how that is any different than rm.

On 04/16/2015 11:28 AM, Ken Chase wrote:
> problem is he's trying to rsync into the target dir and have the 
> side effect of delete. so an empty dir would necessarily need to
> be in the target of course and thus created there, triggering the
> quota block.
> 
> he tried to avoid this by using device files then 'blocking all
> device files' but i think rsync figures out first there's nothing
> to do, so it just stops and doesnt do the delete. wonder if
> --delete-first would help there perhaps.
> 
> however, this is a REALLY obtuse way of running rm. unless of
> course he's trying to inject some kinda options into a script that
> can only run rsync or something wonky like that.
> 
> /kc
> 
> 
> On Thu, Apr 16, 2015 at 11:23:59AM -0400, Kevin Korb said: I don't
> understand what is wrong with rm either.
> 
> But if you must have an empty directory is there a tmpfs where you
> can make one?  Is there already an empty one like /var/empty?
> 
> On 04/16/2015 10:13 AM, Ken Chase wrote:
>> Wow, it took me a few seconds to figure out what you were trying
>> to do.
> 
>> What's wrong with rm?
> 
>> Also I think trying to leverage the side of disqualifying all 
>> source files just to get the delete effect (very clever but 
>> somewhat obtuse!) risks creating a temporary file of some kind
>> in the target at the start of the operation, and if you cant
>> even mkdir then that exceeds disk quota immediately and fails.
> 
>> /kc
> 
> 
>> On Thu, Apr 16, 2015 at 12:20:52PM +0300, ????? ?????? said:
>>> Hi, Rsync.
>>> 
>>> I want to help rsink delete a folder with a large number of
>>> files and folders. Tried this: rsync -a --no-D --delete
>>> /dev/null /home/rc-41/data/000000000000061/2015-04-01-07-04/
>>> skipping non-regular file "null"
>>> 
>>> rsync -a --no-D --delete /dev/zero 
>>> /home/rc-41/data/000000000000061/2015-04-01-07-04/ skipping 
>>> non-regular file "zero"
>>> 
>>> 
>>> That's how it turns out rsync -a --delete /empty_folder/ 
>>> /home/rc-41/data/000000000000061/2015-04-01-07-04/ But this 
>>> option is not satisfied as if the disk is 100% filled to
>>> create an empty folder does not work
>>> 
>>> mkdir /empty folder/ Disk quota ekstseeded
>>> 
>>> Got an error.
>>> 
>>> 
>>> find /home/rc-41/data/000000000000061/2015-04-01-07-04/ -delete
>>> I know not suitable
>>> 
>>> rm -rf /home/rc-41/data/000000000000061/2015-04-01-07-04/ is
>>> also not suitable
>>> 
>>> 
>>> 
>>> How to do it differently?
>>> 
>>> 
>>> -- Sincerely, Dugin Sergey mailto: drug at qwarta.ru QWARTA
>>> 
>>> -- Please use reply-all for most replies to avoid omitting the 
>>> mailing list. To unsubscribe or change options: 
>>> https://lists.samba.org/mailman/listinfo/rsync Before posting, 
>>> read: http://www.catb.org/~esr/faqs/smart-questions.html
> 
> 
>> -- Please use reply-all for most replies to avoid omitting the
>> mailing list. To unsubscribe or change options:
>> https://lists.samba.org/mailman/listinfo/rsync Before posting,
>> read: http://www.catb.org/~esr/faqs/smart-questions.html
> 

- -- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
	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:			http://www.sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUv2JwACgkQVKC1jlbQAQdV8wCfZnxIDPGGj+OiAYb5RDc61OOx
PwAAnj2WkSoEUhZsd6g1yMmFNCMrmhqs
=oH1r
-----END PGP SIGNATURE-----


More information about the rsync mailing list