Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: alt.os.linux,comp.os.linux.misc,comp.unix.programmer Subject: Re: rsync question Date: Sun, 14 Apr 2019 00:53:52 +0100 Organization: A noiseless patient Spider Lines: 43 Message-ID: <87ef65797z.fsf@bsb.me.uk> References: <87k1fx7iid.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="b1a6a6529b5cd7471621deb66cb2fd5a"; logging-data="32012"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ohMneOvDzkFZnwCahBRTEccMcorlnu1E=" Cancel-Lock: sha1:YkqA/f3YDLJ8LBQQkfQFzuNXgko= sha1:L0P2SKPCGAIeXq2rZmyn14r3LXs= X-BSB-Auth: 1.340fff21b09ee1865c12.20190414005352BST.87ef65797z.fsf@bsb.me.uk Xref: csiph.com alt.os.linux:55037 comp.os.linux.misc:26562 comp.unix.programmer:11469 William Unruh writes: > On 2019-04-13, Ben Bacarisse wrote: >> gazelle@shell.xmission.com (Kenny McCormack) writes: >> >>> I'd like to use rsync to do a backup - even though, as I've posted here >>> several times lately, I hate rsync. >>> >>> Basically, you just use "-av" (same as in "cp") and it should "just work". >>> And you can add 'n' to the list of options to do a "dry run" to make sure >>> it will copy what you want (and only what you want). >>> >>> 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). >>> >>> I've read the man page sections on --exclude and "FILTER RULES" and it >>> clear as mud. I'm no man page weenie; I can usually figure them out, but >>> this one is just gibberish. >>> >>> Can anyone explain how I would do what I seek? >>> >>> Note: It looks like maybe you could make a file containing: >>> >>> .cache >>> .local >>> >>> And then use --exclude-from=theFile, but I'm not sure if that will do the >>> right thing. Also, as described above, there are other "dot directories" >>> that also should be excluded. >> >> I think you want >> >> rsync -av --exclude '/.*/' src/ target > > That would include ./ (the current directory) and ..(the > parent directory) which would essentially exclude everything. No it doesn't. -- Ben.