Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., @awscloud, former CTO @artsy, +@vestris, NYC

Email Twitter LinkedIn Github Strava
Creative Commons License

I often need to delete not-versioned files in SVN. Although I am supposed to create projects that place all output outside of the SVN client structure, it’s not always practical. So all those pesky generated files are hard to get rid of and pollute my svn status. I frequently dump the output of svn status | findstr "^?_" into a .cmd file and edit it replacing all ? with del /Q.

We can do better. I added a new tool, svn2 to the Svn2Svn project. Svn2 has a sync command that sends all non-versioned files to the recycle bin. Use at your own risk – this will delete files that haven’t been svn-added.


Svn2 uses SharpSVN which can run a status command. For each file that is not-versioned, we call a Microsoft.VisualBasic.FileIO function to recycle it.

SvnStatusArgs statusArgs = new SvnStatusArgs();
statusArgs.Depth = SvnDepth.Infinity;
statusArgs.ThrowOnError = true;
client.Status(path, statusArgs, new EventHandler<SvnStatusEventArgs>(
    delegate(object sender, SvnStatusEventArgs e)
    switch (e.LocalContentStatus)
        case SvnStatus.NotVersioned:
            Console.WriteLine(" {0} {1}", StatusToChar(e.LocalContentStatus), e.FullPath);
            if (File.Exists(e.FullPath))
                FileSystem.DeleteFile(e.FullPath, UIOption.OnlyErrorDialogs,
            else if (Directory.Exists(e.FullPath))
                FileSystem.DeleteDirectory(e.FullPath, UIOption.OnlyErrorDialogs,