Searching files/extensions/names on a SVN repository via batch file on Windows

I had the problem of searching for specific file extensions on a SVN repository and there was no fast fix in sight. I want to share my little script based on another I found on the net (that other one was for Linux):

@echo off

echo List all ".bat" files from
	svn list --recursive | find ".bat"
	for /l %x in (1, 1, 15) do (
		if %ERRORLEVEL% EQU 0 goto success
		echo Error occured. Trying again...
		goto :svn_list

echo Exiting without completing.
Exit /b

echo Operation complete.

What differs from Linux is generally the “find” command. On Linux it would be “grep” which in fact won’t work on Windows.

So login to your SVN repository and put that script into a batch file (copy the text into a *.txt file and rename it to *.bat). This script will try it 15 times to list all the files you are looking for without any errors. If it can not reach this without any errors in between the 15 tries, it will display an error message and exit the program. If it reaches the goal successfully without any errors it will exit the script with a success message.

If you want to print out the list in a txt file, you can just change the 4th line to the following:

svn list --recursive | find ".bat" > output.txt

Please keep in mind, that a batch file is not easily able to just write output in a text file and display it in the command window. You can only redirect the output. So either text file, or command window.