How to Locate a Lost SVN Repository Directory for Backup (TortoiseSVN Guide)


2 views

Every developer has been there - you set up an SVN repository years ago, and now when you need to perform critical maintenance (like backups or migrations), you can't remember where you stored it on your filesystem. This is especially common when:

  • Working with multiple local repositories
  • Having used default installation paths long ago
  • Migrating between machines without proper documentation

For TortoiseSVN users, we have several efficient ways to trace repository locations:

Method 1: Check Recent Projects

Right-click any folder → TortoiseSVN → Repo-browser. The "Recent" dropdown shows your most recently accessed repositories:

TortoiseProc.exe /command:repobrowser

Method 2: Search for Repository Markers

SVN repositories always contain specific directories. Run this PowerShell command to search your entire drive:

Get-ChildItem -Path C:\ -Include 'format','db' -Directory -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.FullName -match 'db\\revs' }

Using SVN Admin Verification

The svnadmin verify command can help identify valid repositories:

for /r C:\ %i in (.) do @if exist "%i\conf\svnserve.conf" echo %i

Checking TortoiseSVN's Configuration

TortoiseSVN stores recent repository info in the registry:

reg query HKCU\Software\TortoiseSVN /s | findstr "Repositories"

Once you locate your repository, implement these best practices:

  1. Create a README.repos file in your repository root
  2. Set up a centralized repositories.config file
  3. Use consistent directory structures like C:\SVN_REPOS\[project]

Here's a PowerShell script that both locates and backs up SVN repositories:

# SVN Repository Locator and Backup Script
$repos = Get-ChildItem -Path C:\ -Include 'format' -File -Recurse -Depth 4 | 
         Where-Object { $_.DirectoryName -match 'db$' } |
         ForEach-Object { $_.Directory.Parent.FullName }

foreach ($repo in $repos) {
    $backupPath = "D:\SVN_BACKUPS\" + (Split-Path $repo -Leaf)
    svnadmin hotcopy $repo $backupPath
    Write-Host "Backed up $repo to $backupPath"
}

We've all been there - you're preparing for a crucial backup operation, only to realize you can't remember where your SVN repository is physically stored on your hard drive. This guide will walk you through multiple methods to rediscover your repository location, with special attention to TortoiseSVN workflows.

The simplest approach is to examine any existing working copy:

svn info [path_to_working_copy]
# Example:
svn info C:\Projects\MyProject

Look for the "Repository Root" field in the output. This will show the repository URL, which often contains filesystem clues.

If you're using TortoiseSVN as mentioned:

  1. Right-click any folder in Windows Explorer
  2. Select "TortoiseSVN" → "Repo-browser"
  3. The address bar shows the repository URL

SVN repositories have distinctive file signatures. Try searching for:

# Windows Command Prompt
dir /s format

# PowerShell equivalent
Get-ChildItem -Path C:\ -Include format -Recurse -Force -ErrorAction SilentlyContinue

If you're running a local SVN server, check its configuration files:

# Typical Apache SVN configuration location
C:\Program Files (x86)\VisualSVN Server\conf\httpd.conf

Look for or directives that point to repository locations.

TortoiseSVN maintains a history of accessed repositories:

  1. Right-click → TortoiseSVN → Settings
  2. Navigate to "Saved Data"
  3. Click "Clear" next to "URL history" (don't actually clear it)
  4. The dropdown will show previously accessed repositories

Once you've located your repository, consider these best practices:

  • Document the path in your project's README.md
  • Create a symbolic link from a memorable location
  • Add the path to your backup script comments