Bash — svn rm on all matching files

I’ll need this in the future. I needed to do “svn rm” on each instance of something.pyc to remove it from the respository.

Found the solution online (sort of).

find -name "*.pyc" is the obvious part.

find -name "*.pyc" -exec svn rm {} \;

will erase all files ending in .pyc via svn rm.

Alternatively, you can also use something like

find -name "*.pyc" | xargs svn rm

kylefox below says that he needed to specify the path, which would be for current directory find . -name “*.pyc” -exec svn rm {} \;

2 Comments

  1. kylefox says:

    That didn’t work for me — I had to add a dot:

    find . -name “*.pyc” -exec svn rm {} \;

  2. Yuji says:

    Ah, thanks kylefox. Looks like mine defaults to current directory!

Leave a reply to kylefox Cancel reply