3
2
I've supposed to archive a directory with tar and exclude some files. I have a directory $HOME/java which includes some .java and .class files. What I want to do is exclude all .class files using the -X exclude option.
I've created an Exclude file by using find
$ find $HOME/java -name "*.class" > Exclude
Then tried to archive the directory
$ tar -cvfX java.tar Exclude $HOME/java
But somehow it does not do the exclude. The tar version on Solaris does not support exclusion by name.
For homework, I suggest to point the OP in the right direction instead of posting the answer. – Aaron Digulla – 2010-06-28T11:56:47.210
man tar
is too short for an answer ;) - but I'll keep that in my mind. – miku – 2010-06-28T11:57:47.0972@Aaron - I suspect that the homework aspect isn't on using tar, but rather that he needs to turn in his homework as a tarball. Explicit directions, in this case, are probably acceptable. – tvanfosson – 2010-06-28T11:59:02.993
1
--exclude
is only for GNU tar though, not the Solaris native tar. (Though the original poster may want to check if GNU tar is also installed on the system, perhaps in/usr/sfw/bin
,/usr/local/bin
,/usr/gnu/bin
,/opt/sfw/bin
or/opt/csw/bin
.) – alanc – 2010-06-28T14:23:46.127