A the moment I have a registry file which delete the .svn files when right clicking over directory. I would like to extend this windows registry file to also delete some temporary files created from Zend Studio:
- .buildpath
- .project
- .settings (directory)
Following the answers from this question: Windows batch file to delete .svn files and folders
I have:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""
I think this is what you are looking for. I only made changes to the last line.
This solution is similar to what Laf was describing, except he suggested using && before the last command. I think that could give you problems because the next command would only execute if the RD was successful. But your current algorithm attempts to remove the directory from all subdirectories, even when it is not there. I used & so that the next command (DEL) always executes, regardless of the outcome of the RD. I extended the RD to delete both directories, and the added DEL command deletes both files.
I redirected stderr to nul so that you don’t see a bunch of error messages. The algorithm is very inefficient and can generate a lot of error messages depending on the number of subdirectories.
If your requirements get any more complicated, or if you want to develop a more efficient script, you might be better off creating a batch file that does the work, and call the batch file from your registry entry. It’s a bit messy to read and maintain a complicated set of commands on a single line. The escape sequences also become tiresome in the registry.