Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you Tar an svn directory and filter out all the .svn files?

Tags:

svn

filter

tar

I'm trying to create a tar file for deployment of some code but I dont want all the .svn files being deployed.

How can I filter these out? They're in multiple directories...

like image 342
qodeninja Avatar asked Jan 18 '11 17:01

qodeninja


People also ask

How do I delete a .SVN file?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…

How do I delete a .SVN folder recursively?

The find command returns a list of all the subfolders matching “. svn”, and this is then piped to the rm command to recursively delete the directory. Running rm using the full path will remove the confirmation prompt, and the “rf” arguments will recursively delete any folder contents.

What are .SVN files?

SVN stands for Subversion. So, SVN and Subversion are the same. SVN is used to manage and track changes to code and assets across projects.


2 Answers

tar --exclude=.svn -z -c -v -f mytarball.tar.gz mydir/ 
like image 134
jakehurst Avatar answered Oct 15 '22 10:10

jakehurst


If you have a tar version 1.28 or later, try

tar --exclude-vcs

It can be used to backup directories containing:

  • a single svn repo
  • multiple svn repos
  • no svn repos

From the manual:

‘--exclude-vcs’ Exclude files and directories used by following version control systems: ‘CVS’, ‘RCS’, ‘SCCS’, ‘SVN’, ‘Arch’,‘Bazaar’, ‘Mercurial’, and ‘Darcs’.

Note:

For some versions of tar, --exclude-vcs must be the first argument.

like image 23
polras Avatar answered Oct 15 '22 10:10

polras