[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to exclude Some but not All dot files?

On Thu, Aug 16, 2018 at 04:37:47PM +0100, Darac Marjal wrote:
> $ find /home/me/dirToARchive -print -depth | grep -v -x -f
> paths-to-exclude.txt | cpio -o -H ustar | gz > archive.tar.gz
> cpio takes a list of filenames to archive on stdin, so we use find to list
> what we want, then filter that list through grep ("-f foo" says to get a
> list of filter expressions from file foo) before passing to cpio (which
> we've told to make a tar archive rather than its native format).

You still don't want to archive absolute pathnames.

And GNU tar can also read filenames from stdin, with a special GNU option.

Reply to: