I have solaris 10 and my following exclude is not working:
tar -cvf /export/home/backups/$audit-Data-$useday.bkup.tar /Data --exclude=/Data/ssg/output
a /Data/ssg/output/ 0K
a /Data/ssg/output/ssg-ported508.txt 107142K
a /Data/ssg/output/ssg-ported747.txt 1801K
a /Data/ssg/output/ssg-ported574.txt 20146K
a /Data/ssg/output/ssg-ported906.txt 6041K
..etc
Why ?
I am trying to exclude this dir: /Data/ssg/output
There is no --exclude option with tar, this is a GNUism.
You might use this syntax:
tar cvfX /export/home/backups/$audit-Data-$useday.bkup.tar <(echo /Data/ssg/output/) /Data
Alternatively, use GNU tar which might already be installed in /usr/sfw/bin/gtar or somewhere else.
1 Like
Worked perfectly. Thank you
1) How can I exclude multiple dir from /Data in this command:
tar -cvf /export/home/backups/$audit-Data-$useday.bkup.tar <(echo /Data/ssg/output) /Data
2) I do have gtar installed. How do you use gtar in this case? I never used it before?
Thanks
1) Yes, you can exclude multiple directories, here is one way:
tar cvfXX /export/home/backups/$audit-Data-$useday.bkup.tar <(echo /Data/ssg/output/) <(echo /Data/ssg/someOtherDirectory/) /Data
2) More or less the syntax you were trying:
/usr/sfw/bin/gtar -cvf /export/home/backups/$audit-Data-$useday.bkup.tar --exclude=Data/ssg/output /Data
1 Like