HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- to exclude files from tar
Operating System - HP-UX
1835156
Members
2590
Online
110077
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
06-14-2006 09:06 AM
06-14-2006 09:06 AM
to exclude files from tar
I tried to tar a directory but want to exclude one of the subdiretories...
I tried the command to tar the tmp directory but not /tmp/ex:
tar -cvfX a.tar /tmp/ex /tmp
it doesn't work...
thanks for your solution!!!
I tried the command to tar the tmp directory but not /tmp/ex:
tar -cvfX a.tar /tmp/ex /tmp
it doesn't work...
thanks for your solution!!!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 09:10 AM
06-14-2006 09:10 AM
Re: to exclude files from tar
a couple of links to read that will help you obtain your desired results:
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=964739
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=993153
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=964739
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=993153
If no one ever took risks, Michelangelo would have painted the Sistine floor. -Neil Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 12:36 PM
06-14-2006 12:36 PM
Re: to exclude files from tar
Here's how I do it on my linux box:
#!/bin/bash
# Script to backup Directories
#
LOGFILE=/tmp/dumphome.log
GZFILE=`date |awk '{print ($1)}'`.tar.gz
TARFILE=`date |awk '{print ($1)}'`.tar
echo "Backup of files on Ix at " `date` >$LOGFILE 2>&1
# remove the old gzip file
if [ -f /home/backups/$GZFILE ]; then
rm -f /home/backups/$GZFILE >>$LOGFILE 2>&1
else
echo "no old $GZFILE found..." >>$LOGFILE 2>&1
fi
# backup the files
tar -cf /home/backups/$TARFILE `cat /root/backupfiles` >>$LOGFILE 2>&1
# gzip the tar file
gzip /home/backups/$TARFILE >>$LOGFILE 2>&1
chown backup /home/backups/$GZFILE
echo "/home/dumphome is complete " `date` >>$LOGFILE 2>&1
mail -s "Ix: Home Backup Complete" gjwild <$LOGFILE
# cat /root/backupfiles
/bin
/boot
/dev
/etc
/home/httpd
/initrd
/lib
/misc
/mnt
/opt
/proc
/root
/sbin
/scripts
/tmp
/usr
/var
Notice, that in /home, I only backup /home/httpd
Basically, instead of excluding, I implicitly include.
Rgds...Geoff
#!/bin/bash
# Script to backup Directories
#
LOGFILE=/tmp/dumphome.log
GZFILE=`date |awk '{print ($1)}'`.tar.gz
TARFILE=`date |awk '{print ($1)}'`.tar
echo "Backup of files on Ix at " `date` >$LOGFILE 2>&1
# remove the old gzip file
if [ -f /home/backups/$GZFILE ]; then
rm -f /home/backups/$GZFILE >>$LOGFILE 2>&1
else
echo "no old $GZFILE found..." >>$LOGFILE 2>&1
fi
# backup the files
tar -cf /home/backups/$TARFILE `cat /root/backupfiles` >>$LOGFILE 2>&1
# gzip the tar file
gzip /home/backups/$TARFILE >>$LOGFILE 2>&1
chown backup /home/backups/$GZFILE
echo "/home/dumphome is complete " `date` >>$LOGFILE 2>&1
mail -s "Ix: Home Backup Complete" gjwild <$LOGFILE
# cat /root/backupfiles
/bin
/boot
/dev
/etc
/home/httpd
/initrd
/lib
/misc
/mnt
/opt
/proc
/root
/sbin
/scripts
/tmp
/usr
/var
Notice, that in /home, I only backup /home/httpd
Basically, instead of excluding, I implicitly include.
Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 12:37 PM
06-14-2006 12:37 PM
Re: to exclude files from tar
Here's how I do it on my linux box:
#!/bin/bash
# Script to backup Directories
#
LOGFILE=/tmp/dumphome.log
GZFILE=`date |awk '{print ($1)}'`.tar.gz
TARFILE=`date |awk '{print ($1)}'`.tar
echo "Backup of files on Ix at " `date` >$LOGFILE 2>&1
# remove the old gzip file
if [ -f /home/backups/$GZFILE ]; then
rm -f /home/backups/$GZFILE >>$LOGFILE 2>&1
else
echo "no old $GZFILE found..." >>$LOGFILE 2>&1
fi
# backup the files
tar -cf /home/backups/$TARFILE `cat /root/backupfiles` >>$LOGFILE 2>&1
# gzip the tar file
gzip /home/backups/$TARFILE >>$LOGFILE 2>&1
chown backup /home/backups/$GZFILE
echo "/home/dumphome is complete " `date` >>$LOGFILE 2>&1
mail -s "Ix: Home Backup Complete" gjwild <$LOGFILE
# cat /root/backupfiles
/bin
/boot
/dev
/etc
/home/httpd
/initrd
/lib
/misc
/mnt
/opt
/proc
/root
/sbin
/scripts
/tmp
/usr
/var
Notice, that in /home, I only backup /home/httpd
Basically, instead of excluding, I implicitly include.
Rgds...Geoff
#!/bin/bash
# Script to backup Directories
#
LOGFILE=/tmp/dumphome.log
GZFILE=`date |awk '{print ($1)}'`.tar.gz
TARFILE=`date |awk '{print ($1)}'`.tar
echo "Backup of files on Ix at " `date` >$LOGFILE 2>&1
# remove the old gzip file
if [ -f /home/backups/$GZFILE ]; then
rm -f /home/backups/$GZFILE >>$LOGFILE 2>&1
else
echo "no old $GZFILE found..." >>$LOGFILE 2>&1
fi
# backup the files
tar -cf /home/backups/$TARFILE `cat /root/backupfiles` >>$LOGFILE 2>&1
# gzip the tar file
gzip /home/backups/$TARFILE >>$LOGFILE 2>&1
chown backup /home/backups/$GZFILE
echo "/home/dumphome is complete " `date` >>$LOGFILE 2>&1
mail -s "Ix: Home Backup Complete" gjwild <$LOGFILE
# cat /root/backupfiles
/bin
/boot
/dev
/etc
/home/httpd
/initrd
/lib
/misc
/mnt
/opt
/proc
/root
/sbin
/scripts
/tmp
/usr
/var
Notice, that in /home, I only backup /home/httpd
Basically, instead of excluding, I implicitly include.
Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP