views:

917

answers:

5

I have a PowerShell script I use for creating distributions that copies compiled files from a few places and zips them up with winrar. In the script, I change to a directory containing the folders I want to run and execute this:

Invoke-Expression ($WinRAR + " a " + $zipPath + " " + $WinRARFilter + " " + $DistName + "-zip " + $WinRAROpts)

Which actually executes this:

E:\Progs\WinRar\WinRar.exe a C:\Users\Echilon\Documents\Coding\ResourceBlender-Express\trunk\dist\resourceblender-express_1.44-zip.zip -x*\.svn\* -x*\.svn -x\.svn resourceblender-express-zip -r -s -m5 -inul

Yet none of the .svn directories are excluded from the zip file. This used to work and I have no idea why it doesn't now, but I can't get it to exclude the right files.

The full script is on codeplex at http://resourceblender.codeplex.com/sourcecontrol/changeset/view/27742?projectName=resourceblender#456701 (at the bottom of the script)

Could someone with some experience in PowerShell shed some light on this please?

+10  A: 

The right way of doing this is to perform a svn export which will create a copy of the project without the .svn directories (and anything else not version controlled) and then do the zip.

anon
I know, but I'd rather not write additonal scripts right now to export a copy. The alternative is just Remomve-Item -Recurse which I want to avoid if possible.
Echilon
+2  A: 

I agree with Neil Butterworth comment regarding the use of the svn export command being more appropriate in this case. Talking about WinRar you might consider using an -e switch to skip hidden folders (.svn is a hidden folder) and an -ep switch to exclude it by name.

Please refer to WinRar manual for more information

Ilya Kochetov
I know this should work, but adding -eh to the switches has no effect. This is really starting to baffle me, the .svn folders are definitely hidden.
Echilon
+1  A: 

I had the same problem and found this page with no solution, so for other people googling it the correct switch is :

-x*\.svn\*
PlageMan
That was actually one of the combinations which didn't work for me.
Echilon
A: 

I ended up using

-x*\.svn*

This will ignore the actual .svn folder and not just everything inside of it. I'm also using WinRAR 3.80. Have you tried updating your version of winrar ?

Thought the svn export method worked out a lot better for me cuz I didn't get all the debug builds and misc .dlls

HaxElit
A: 

Hi, I had the same problem, solved using:

-x*.svn\

I use WinRar v3.93 for Windows. Please note the final slash. Best regards, Andrea Gramazio

Andrea Gramazio