Reputation: 359
Im trying to tar a folder with subdirectories but i want to exclude all folders with the name "log".
I have search and seen that the tar command have the option of --exclude the problem is that this option required to be specific folder not a dynamic one.
Is there any other way?
so far the command i have is:
tar czf ROOT/backup/servers/20150504.tar.gz ./servers --exclude=".*log.*"
Upvotes: 0
Views: 807
Reputation: 395
If you want to exclude all folders with the name "log", probably using -X is more convenient. Here is an example:
$ find ./servers -type -d -name *log* > excludefiles
$ tar czf ROOT/backup/servers/20150504.tar.gz -X excludefiles ./servers
Upvotes: 3