Saturday, September 20, 2008

Subversion SVN Backup - HotCopy Not a folder copy

Subversion hotcopy is tricky, because you have to empty the contents of the destination folder before you run the svnadmin hotcopy command.

To do this I create a console app and run it before the svnadmin command runs.App is really simple and has the following code in it.

''share of the destination folder
Dim folder As String = "\\svnbackupserver\svnreposbackup"
Dim rootFiles() As String = System.IO.Directory.GetFiles(folder)
For Each file In rootFiles
System.IO.File.SetAttributes(file, FileAttributes.Normal)
Dim dr() As String = System.IO.Directory.GetDirectories(folder)
For Each item In dr
Dim str() As String = System.IO.Directory.GetFiles(item)
For Each item1 In str
System.IO.File.SetAttributes(item1, FileAttributes.Normal)
System.IO.Directory.Delete(item, True)
Catch ex As Exception
End Try
End Sub

C:\Batch\SVNBackup.exe svnadmin hotcopy \\svnserver\svnrepo \\svnserverbackup\SvnReposBackup

No comments:

Post a Comment

IIS Manager Crashes on Load/Start Windows 7, IIS 7.5

IIS Manager Crashes on Start  Windows 7, IIS 7.5, Power Shell 5.1. Here is the error I got in the event viewer. IISMANAGER_CRASH IIS Ma...