Automatically remove Subversion unversioned files

前端 未结 30 3160
感情败类
感情败类 2020-11-28 18:54

Does anybody know a way to recursively remove all files in a working copy that are not under version control? (I need this to get more reliable results in my automatic build

30条回答
  •  误落风尘
    2020-11-28 19:10

    If you are on windows command line,

    for /f "tokens=2*" %i in ('svn status ^| find "?"') do del %i
    

    Improved version:

    for /f "usebackq tokens=2*" %i in (`svn status ^| findstr /r "^\?"`) do svn delete --force "%i %j"
    

    If you use this in a batch file you need to double the %:

    for /f "usebackq tokens=2*" %%i in (`svn status ^| findstr /r "^\?"`) do svn delete --force "%%i %%j"
    

提交回复
热议问题