Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude .svn folders from a ZIP archive?

Tags:

svn

zip

I am working on a game (Quake 3) and use an SVN repository to store the code tree. The tree also contains game data (textures, models, etc). This must be put into a PK3 archive (a standard ZIP archive with a different extension). I use the ZIP utility in a simple script to create the PK3 archive.

My problem is that the game data is also versioned, and the folder containing the data is cluttered with all those '.svn' subfolders. Of course, ZIP includes these subfolders into the archive. They are not needed by the game. Is there a simple way to tell ZIP to exclude all '.svn' subfolders from the archive?

like image 985
speaker Avatar asked Aug 16 '13 08:08

speaker


People also ask

How do I remove all .svn from a folder?

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.

How do I exclude a zip file?

Exclude Multiple Files/Directories from Zip Archive You can define -x multiple times in a single zip command to exclude multiple files and directories from zip archive.

What are .svn folders?

In particular, each directory in your working copy contains a subdirectory named . svn, also known as the working copy's administrative directory. The files in each administrative directory help Subversion recognize which files contain unpublished changes, and which files are out of date with respect to others' work.

How do I delete a .svn file in Windows?

Right click on the project, go to Team->disconnect. It will open a popup where you select the first option: 'Also delete the SVN meta-information from file system. ' This will remove all the SVN folders automatically along with svn property files that you might forget sometimes while removing .


1 Answers

zip -r output.zip inputdir -x "**/.svn**"

this will exclude everything starting with ".svn" in any subfolder

like image 174
Gianluca P. Avatar answered Oct 23 '22 07:10

Gianluca P.