SVN command to delete all locally missing files

If you’re using Mac (Darwin) or Linux you can pipe the outputs of the following commands to svn rm for all missing files. You can set the current working directory to the appropriate directory or subdirectory before running these – dependent on whether you want to run this your entire working copy, or only a subset.

  1. Run an svn status
  2. Search for lines that begin with “!” (missing)
  3. Print the “–force” (svn argument) and the second column (the file name) of the output from #2
  4. Run svn rm using the output of #3 as arguments

So the full command is:

svn st | grep ^! | awk '{print " --force "$2}' | xargs svn rm

References:

  • Examining fields (columns) with awk
  • Using xargs to run shell commands with arguments

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)