Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: files, Up: Choosing


6.4 Excluding Some Files

To avoid operating on files whose names match a particular pattern, use the --exclude or --exclude-from options.

--exclude=pattern
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 ‘tar -cf src.tar --exclude='*.o' src’.

You may give multiple --exclude options.

--exclude-from=file
-X file
Causes tar to ignore files that match the patterns listed in file.

Use the --exclude-from option to read a list of patterns, one per line, from file; tar will ignore files matching those patterns. Thus if tar is called as ‘tar -c -X foo . and the file foo contains a single line *.o, no files whose names end in .o will be added to the archive.

--exclude-caches
Causes tar to ignore directories containing a cache directory tag.

When creating an archive, the --exclude-caches option causes tar to exclude all directories that contain a cache directory tag. A cache directory tag is a short file with the well-known name CACHEDIR.TAG and having a standard header specified in https://www.brynosaurus.com/cachedir/spec.html. Various applications write cache directory tags into directories they use to hold regenerable, non-precious data, so that such data can be more easily excluded from backups.

 
 
  Published under the terms of the GNU General Public License Design by Interspire