Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete non-empty folder in Sublime Text 2
# add this to the main command array...
{ "caption": "Delete Folder and Contents", "command": "delete_folder_recursive", "args": {"dirs": []} }
# add the following class...
class DeleteFolderRecursiveCommand(sublime_plugin.WindowCommand):
from shutil import rmtree
def run(self, dirs):
try:
rmtree(dirs[0])
except:
sublime.status_message("Folder could not be deleted")
def is_visible(self, dirs):
return len(dirs) == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment