When you are developing on your desktop and FTPing files up to your server, you can quickly end up with a mess of .svn or .git folders or files hanging around making a mess of things (you are using version control, right?). Apart from being untidy, these files can wind up as a security risk if they end up on a live site.
There are a number of methods you can try to keep them at bay – avoid selecting them for upload or mark them as hidden, but another convenient way is to tell your FTP client not to send them.
Looking at two popular clients – FileZilla and WinSCP – we can see how this can be done. Essentially we are filtering what is sent on name, so the technique can apply to any other files you wouldn’t want to upload (such as Window’s “desktop.ini” files). You’ll just have to keep in mind that it is happening in the background; trying to debug where plugin.svn.php got to could be frustrating!
FileZilla makes this easy with a built in menu. Go View > Filename Filters (or Ctrl + I) to open the directory listing filters dialogue.
There should already be a configured filter for CVS and SVN, you may want to edit the filter rule to include .git if you are using that.
In WinSCP the dialogue is a bit more basic. You can find it through Options > Preference in the Transfers section. That text box at the bottom in ‘Other’.
You can use the File Mask syntax to define filters, separating each one with a semicolon. To cover SVN and Git, you could use
And you’re all set! Hopefully you can now look forward to slightly neater file-systems.