I have managed to find all 'SVN working copies' on Win XP.
I did it using the http://stackoverflow.com/a/9016024/205814 provided by Alexey Shcherbak.
Here is a summary of the process using
the PowerShell method.
Test to see if you have PowerShell already installed.
Windows PowerShell is a command-line shell and scripting environment that brings the power of the .NET Framework to command-line users and script writers.
Test to see if it is already installed by attempting to start it.
To start Windows PowerShell from the Run box, click
Start, click
Run, and type:
powershell
If that does not work...
Install it
- Download Microsoft Windows PowerShell 1.0 for Windows XP from http://www.cnet.com/
- (PowerShell 2 for Windows XP is also available, but I did not use it. (http://mintywhite.com/vista/vmaintenance/install-powershell-20-windows-xp/) )
Once its installed...
Start PowerShell and have a play
Start >
All Programs >
Windows PowerShell 1.0 >
Windows PowerShell
http://www.youtube.com/watch?v=qv0ZpVfKiRs&feature=player_embedded.
Create a PowerShell script
Copy Alexey Shcherbak's http://stackoverflow.com/a/9016024/205814 (that finds the svn working copies) into a text file and save it as something like
C:\PowerShellScripts\FindSvnWorkingDirectories.ps1.
I modified it slightly to search my C drive and to suppress
access denied errors :
$prev = "^$"
Get-ChildItem -ErrorAction SilentlyContinue -Recurse -Force -Include ".svn" -Path "c:\" `
| ?{$_.PSIsContainer -and $_.Fullname.StartsWith($prev)-eq $false}`
| %{ $prev=$_.Fullname.TrimEnd(".svn"); $prev}
Unfortunately I have limited knowledge of PowerShell scripting language, so perhaps some wise expert can edit this answer to explain what this script does in detail.
Get-ChildItem, by default, is an alias of the dir command.
-ErrorAction SilentlyContinue - Prevents showing errors such as Access to the path 'C:\System Volume Information' is denied http://www.computerperformance.co.uk/powershell/powershell_erroraction_silentlycontinue.htm.
-Recurse means search recusively.
-Force ensures hidden files are found.
-Include ".svn" identifies the filename that we are searching for.
-Path "c:\" idientifies the path to search.
- ` I assume that the backtick means continue the line.
| pipes the output of Get-ChildItem into the next cmdlets
- I don't know what the rest is doing (it looks like a Ternary operation but I'm not sure).
Allow PowerShell to run the script
By default, for security, PowerShell's
ExecutionPolicy does not let you run PowerShell scripts. So, you need to allow it to do so.
See http://technet.microsoft.com/en-us/library/ee176949.aspx for more info.
I did the following:
Note: The hash symbol (#) is just shotrthand for the command prompt.
Determine the current
ExecutionPolicy:
# Get-ExecutionPolicy
Restricted
If, like mine, its
Restricted. Change the policy to allow a script to run:
# Set-ExecutionPolicy RemoteSigned
Run the PowerShell script
Then run the script to find the svn working copies. Note you need to specify the
full path to the PowerShell script.
# C:\PowerShellScripts\FindSvnWorkingDirectories.ps1
If there are loads of directories on the PC it may take some time. The results should appear.
Copy and Paste the results to somewhere
I did this by selecting the output text with my mouse. Then, to copy it:
Click the
PowerShell icon (in the top-left of the Window) >
Edit >
Copy
Then I pasted it into a text editor.
Revert the PowerShell Excecution Policy to its original state
Since I rarely use PowerShell and I loosened the Excecution Policy only to run this, one-off, script I am going to revert it back to its orignal state for security.
Determine the current
ExecutionPolicy:
# Get-ExecutionPolicy
RemoteSigned
Change the policy to revert it to its original state:
# Set-ExecutionPolicy Restricted
So that's how I did it.