Author : Piyush Gupta
To avoid operating on files whose names match a particular pattern, use the `--exclude' or `--exclude-from' options.
Causes tar to ignore files that match the pattern.
The `--exclude=pattern' option prevents any file or member whose name matches the shell wildcard (pattern) from being operated on. For example, to create an archive with all the contents of the directory `src' except for files whose names end in `.o', use the command
Example:
To avoid operating on files whose names match a particular pattern, use the `--exclude' or `--exclude-from' options.
Causes tar to ignore files that match the pattern.
The `--exclude=pattern' option prevents any file or member whose name matches the shell wildcard (pattern) from being operated on. For example, to create an archive with all the contents of the directory `src' except for files whose names end in `.o', use the command
Example:
- Below command will archive all files and directories under public_html directory except wp-content/cache directory and create a archive file named backup.tar.gz.
- Exclude a single directory inside other directory. Create archive of all files under public_html directory ignoring all files and folders including text backup in there named
- You can define multiple exclude in single command. For example create and archive of all files under public_html directory ignoring .svn or .git files and directories.
- To exclude a specific file define full path of the file. For example exclude “logs/access.log” inside public_html directory.
- Create archive of all files under public_html directory ignoring all files and directories starting with dot ( . ) (hidden files).
No comments:
Post a Comment