Making a tar without the .svn directories

Translation of the original in Catalan. Read it in: CatalàCastellano

After many years of Unix/Linux experience I still sometimes get stuck on silly things like the one I mention in the title, how sad, eh!? well, so that it doesn't happen to you like it did to me, who took almost 10min to get inspired and do something as simple as this:

tar cvfz fitxer.tar.gz $(find directori/ -type f | grep -v .svn)

I suppose it is obvious to understand that we want to make a copy in a compressed file of the code in directori without the .svn files and directories of the version control (subversion).

3 comments

Comments from the old blog, as they were written. Comments are closed.

  1. melmak

    En su dia perdí un buen rato en algo muy parecido, sólo que queria excluir del tarball los directorios CVS. Tras perder los 10 minutillos porculeros de rigor, vi que el comando tar tenia la opcion --exclude que me venia al pelo.

    tar --exclude=CVS -chzvf tarball.tar.gz directorio

  2. marc

    també existeix la possibilitat de fer un

    svn export (Export a clean directory tree)

  3. —

    Gràcies per les respostes, només comentar que la solució del svn no la podia usar perquè no tenia accés al repositori en aquell moment. El tema de l'explude el vaig provar i no sé perquè no me'n sortia per això vaig acabar optant pel joc amb el find i el grep.

    Moltes gràcies igualment per les idees ;)