Development WordPress

One Command to Add All New Files and Delete Removed Files SVN

When developing WordPress plugins, SVN is still used. It’s only used for plugin deployment though, not really during development. So your typical actions are just add files, remove files, tag a directory and commit. I always found adding and removing files such a hassle, so here’s a short script that does it for you.

Background: I regularly release updates to my plugin Stackable, and I find adding and removing SVN files bothersome. And when that happens, automate it!

Creating the SVN Add/Remove Files Script

In my setup, I have an SVN directory where I store all my code. I have this structure:

├── my-plugin-code

Go to the SVN directory, and create a new file called


Then when the editor opens, add this inside:

svn status | grep '^!' | awk '{print $2}' | xargs svn delete
svn status | grep '^?' | awk '{print $2}' | xargs svn add

Save and close the file (in vim, press the esc key, then type in :wq then hit enter.

Now you’ll need to make the script executable:

chmod a+x

You should end up with this directory structure:

├── my-plugin-code

Using the SVN Add/Remove Files Script

Now when you add new files in SVN, just head over to your my-plugin-code folder, then do this:


This will add all the new files, and remove all the deleted files. It’s a real time saver!

By Benjamin Intal

Benjamin is an avid WordPress plugin developer, a full-stack developer, owner and lead developer of Gambit, founder of Stackable Blocks, Page Builder Sandwich, and creator of more than 30 WordPress plugins in CodeCanyon.

Connect with me on Twitter @bfintal

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.