这里稍微修改了脚本,以便同时考虑带有空格的 Windows 文件。同时,missing.list文件也将在最后被删除。
我将以下内容保存在我的 SVN bin 目录(在% PATH 环境中设置)的 svndel.bat 中,这样就可以在命令提示符下从任何文件夹调用它。
### svndel.bat
svn status | findstr /R "^!" > missing.list
for /F "tokens=* delims=! " %%A in (missing.list) do (svn delete "%%A")
del missing.list 2>NUL
#! /bin/bash
# 1. get all statii in the working copy
# 2. filter out only missing files
# 3. cut off the status indicator (!) and only return filepaths
MISSING_PATHS=$(svn status $1 | grep -E '^!' | awk '{print $2}')
# iterate over filepaths
for MISSING_PATH in $MISSING_PATHS; do
echo $MISSING_PATH
svn rm --force "$MISSING_PATH"
done