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

How to exclude Some but not All dot files?



I'm trying to make a gzipped tarball. I want to exclude only a certain list of dot files but NOT ALL dot files (in other words tar the other dot files not on the list).

I have (this is just an example):

tar -czf archive.tgz /home/me/dirToARchive/. --exclude=/home/me/dirToARchive/.mysetuptemp --exclude=/home/me/dirToARchive/.myotherdotfile --exclude=/home/me/dirToARchive/.anotherdotfile

In the directory I want to Include *all other* dot files not in the --exclude above.

I found it doesn't matter if I put the --excludes before the -czf or after everything, I still end up with EVERY dot file in the directory instead of ONLY the ones that are NOT on the list.

I'm not great with tar, I admit.

Is there a way to do what I'm proposing?


Reply to: