tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude=patternExample:
Excluding files whose names end in '.txt'.
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude='*.txt'
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude=patternExample:
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude='*.txt'
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude="./directoryToExclude1" --exclude="./directoryToExclude2"Note that there is no "/" at the end of the path to the directory to exclude!