user1670340
user1670340

Reputation: 159

svn export command line to export files from subversion with wildcard in filenames or extension

I have a repository in which comprises .cpp, .h, .txt and other files.

I want to export only the .h files to specified local directory.

I'm getting an error with this code:

svn export --username %SVN_USER% --password %SVN_PASSWORD% --force --non-interactive "http://justatest.com/svn/repos/TrackingProjects/*.h" c:\exported_files

Is there a support a wildcard support for this? I have workaround for this but I just want know if this is possible in svn command line.

Upvotes: 2

Views: 2094

Answers (1)

lit
lit

Reputation: 16236

The export command does not accept wildcards. How about a workaround script? This gets a list of files from the repo directory, filters the desired ones, then exports them individually.

@echo off
set "DESTDIR=C:\exported_files"
set "REPODIR=http://justatest.com/svn/repos/TrackingProjects"
set "TEMPFILE=%TEMP%\exfiles.tmp"
svn ls "%REPODIR%" | findstr /R "\.h$" >"%TEMPFILE%"
for /f "delims=" %%f in ('type "%TEMPFILE%") do (
    svn export "%REPODIR%/%%~f" "%DESTDIR%"
)
if exist "%TEMPFILE%" (del "%TEMPFILE%")
exit /B

Upvotes: 1

Related Questions