- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to exlude files/directoris with tar
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 08:46 AM
тАО12-23-2008 08:46 AM
Usually I'm using
tar -cvf - /logs/ -X lost+found| gzip -c > /su02/logs.gz # tar and compress
I'd like to exclude systematically the lost+found directory. How to do this small trick ? I know that tar and -X option could work but ....
Thanks in advance
Bests Regards
Den.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 09:44 AM
тАО12-23-2008 09:44 AM
Re: How to exlude files/directoris with tar
Have you tried:
tar -cvf - /logs/ -X /logs/lost+found | ...
(Or does that still do the files in that directory?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2008 05:49 AM
тАО12-26-2008 05:49 AM
Solutionhere another way to exclude some files from being compressed with tar:
tar -zcvf logs.tgz /logs --exclude="lost+found"
Also to exclude it all the time, you could use the environment variable TAR_OPTIONS
export TAR_OPTIONS="--exclude=lost+found"
In that case this option would be used each time you invoke the tar command.
for more details -> man tar
Regards,
Thierry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2008 09:10 AM
тАО12-26-2008 09:10 AM
Re: How to exlude files/directoris with tar
http://www.gnu.org/software/tar/manual/html_node/exclude.html#SEC103
"-X name" seems to be equivalent to
"--exclude-from=file", not to
"--exclude=pattern". So, unless "lost+found"
is a file containing "a list of patterns"
(which seems unlikely), you would seem to be
using the wrong option.
> [...] /logs/ [...]
Specifying an absolute source path
("/something") instead of a relative one
("something") may be asking for extra
trouble if you'd ever like to restore the
files to a different location. (GNU "tar"
has options to allow this, but some people
seem to have trouble with GNU "tar" options.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-20-2009 06:48 AM
тАО01-20-2009 06:48 AM