Xanderu
Xanderu

Reputation: 777

SVN backup batch wont recognize spaces

I'm trying to create an SVN backup of my Google docs folder and any folders with a space get truncated at the space

for /f "tokens=2*" %%i in ('svn.exe status C:\Google ^| find "?"') do (svn.exe add "%%i")
svn.exe commit -m "automatic commit"

When I break it down and just run

svn.exe status C:\Google ^| find "?"

The result is

  ?       C:\Google\This Is A Test

So I echoed it to see why the batch was failing to commit everything

for /f "tokens=2*" %i in ('svn.exe status C:\Google ^| find "?"') do (echo %i)

and the result was

C:\Google\This

Any ideas how to get around this?

Upvotes: 2

Views: 68

Answers (1)

David Ruhmann
David Ruhmann

Reputation: 11367

Change to tokens=1,* and use %%j

for /f "tokens=1,*" %%i in ('svn.exe status C:\Google ^| find "?"') do (svn.exe add "%%j")
svn.exe commit -m "automatic commit"

The tokens=2* is taking the second space delimited value into %%i and the remaining in %%j

if you echo %%j you will see Is A Test.

Upvotes: 1

Related Questions