Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a distribution archive of my code that includes a subset of directories and excludes all the subversion files. I would like the files to be added to the archive with a root folder that identifies the version of the release, so that when the archive is unzipped it will use this root folder (i.e. myAppV1.3)

I can't find a 'switch' for this, so I'm currently having to zip everything up (using the 7zip exclusions to filter out the files I don't want) then unzip it to my specified folder. Then zip that entire folder up again.

Example of the current three step process I am using:

c:\dev\myApp>7za -xr!?svn\* a @listOfFilesInRelease.txt 
c:\dev\myApp>7za -omyAppV1.3 x
c:\dev\myApp>7za a myAppV1.3

Is there a more elegant way to be doing this?

share|improve this question
up vote 3 down vote accepted

Based on info and inspiration provided by Johannes Rössel, (basically that the compression applications don't support what I'm trying to do), I've come up with a more elegant way to resolve my specific scenario. While this doesn't solve the named root folder in an archive issue, it may provide people who come in search of an answer a different way at looking at their own problem.

My solution to get around the 3 step archiving process was to replace the first two steps with a Source Control checkout (by tag) into a named folder.

This is a much more elegant solution as is how I should have been attacking the problem in the first place (as it ensures that the final distribution matches what is in source control).

share|improve this answer
Subversion also has a handy export command which ensures that you get a clean checkout without all the subversion directories. – Joey Oct 27 '09 at 9:13
Excellent thanks again Johannes. That is just what I need. – user9632 Oct 27 '09 at 10:35

It has been that way for nearly all compression formats I know or the applications that handle them. Looking at the ZIP file format, though, I think it could theoretically be possible. There is just not much incentive to implement this, apparently.

But why aren't you including the folder in the first place?

share|improve this answer
The main reason I'm not including the directoy in the first place is I want to include the version number as part of the archive. I also need to 'exclude' some files which is easy to do with 7zip (at least compared to making a directoy and copying the files into that before zipping). – user9632 Oct 27 '09 at 6:54

You could do it as two step process

  • export source code from subversion into a directory with a set name
  • use 7-zip to pack that directory

svn export path-to-repository root-dir-name
7za a name-of-archive root-dir-name

Root-dir-name is name of directory into which you will export the files.

In your example you would do

svn export path-to-repository MyAppV1.3

This will export only your project's sources into directory named MyApp1.3, while omitting all subversion diles. After this use 7-zip to create archive.

7za a MyAppV1.3

This will make zip archive from the folder where you exported the source. The archive will have files in root directory named MyAppV1.3. You could of course use 7z as extension to get better compression.

For command line SVN client I recommend SlickSVN.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .