Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Carlos E. R." Newsgroups: alt.os.linux,comp.os.linux.misc,comp.unix.programmer Subject: Re: rsync question Date: Sat, 4 May 2019 20:04:54 +0200 Lines: 53 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net avllrMgzARkNCFmf06JLsg/6Kr0Liqk1ZakBqDtggV1lDZv8Jw Cancel-Lock: sha1:j+gE0NJVRaM05mNVVQGskzwvyNQ= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 In-Reply-To: Content-Language: en-US Xref: csiph.com alt.os.linux:56056 comp.os.linux.misc:26930 comp.unix.programmer:11696 On 04/05/2019 18.35, Javier wrote: > This has been a long thread with many interesting subtopics discussed. > Possibly this reply comes too late. > > The best way of filtering the list of files is to use find and > filter its output with grep (or use the options of find to select > which files you want if grep is not enough). > > Implementing a lot of filter options inside rsync goes against > the Unix philosophy of having every command having as few options > as possible and reading its input from stdin. [1] But then you may end with a huge list of files, larger than 64 kilobytes, which poses another problem. > The best is to avoid completely the options of the kind --exclude-X. > tar also has a dozen of --exclude-X options. Every tool tries to reinvent > the wheel (i.e. grep filtering) in a different non-standard manner. > > pax wisely skipped implementing all those unnecessary options from > its beginning and just relied on what it's fed from stdin. [2] > > With rsync you can still follow the Unix philosophy and get the list > of files from stdin if you use '--files-from=-' > > From rsync(1) > --files-from=FILE > Using this option allows you to specify the exact list of files > to transfer (as read from the specified FILE or - for standard > input). It also tweaks the default behavior of rsync to make > transferring just the specified files and directories easier: > > o The --relative (-R) option is implied, which preserves > ... > > For what you requested > >> However, I would like to "exclude" some files. Specifically, I'm going to >> backup my home directory and I want to exclude anything that starts with a >> dot and is a directory. We're talking things like .local and .cache, which >> are, as far as I can tell, useless (and vast). > > this gets very close [3] > > find . | grep -v '^\./\.' |\ > rsync --files-from=- . remote:/dest I think it is slower running than using rsync alone. -- Cheers, Carlos E.R.