To exclude files with patterns containing preceding and trailing characters : 1

To exclude files with patterns containing preceding and trailing characters :

tar -cvf backup.tar --exclude="*.log" --exclude="cache*" public_heml/

Here is what the above code is Doing:
1. tar -cvf backup.tar – This is the command to create a tar file.
2. –exclude=”*.log” – This is the first file to exclude from the tar file.
3. –exclude=”cache*” – This is the second file to exclude from the tar file.
4. public_html/ – This is the directory that we want to backup.

Similar Posts