Skip to content

Instantly share code, notes, and snippets.

@oeway
Created May 17, 2019 08:45
Show Gist options
  • Save oeway/538a19795e13ffe7f3ed8b0a35257485 to your computer and use it in GitHub Desktop.
Save oeway/538a19795e13ffe7f3ed8b0a35257485 to your computer and use it in GitHub Desktop.
<docs lang="markdown">
[TODO: write documentation for this plugin.]
</docs>
<config lang="json">
{
"name": "RemoveFolder",
"type": "native-python",
"version": "0.1.0",
"description": "[TODO: describe this plugin with one sentence.]",
"tags": [],
"ui": "",
"cover": "",
"inputs": null,
"outputs": null,
"flags": [],
"icon": "extension",
"api_version": "0.1.5",
"env": "",
"requirements": [],
"dependencies": []
}
</config>
<script lang="python">
from imjoy import api
import asyncio
import os
import shutil
class ImJoyPlugin():
def setup(self):
api.log('initialized')
async def run(self, ctx):
retObj = await api.showFileDialog({'engine': api.ENGINE_URL})
confirm = await api.confirm(f'Are you sure you want to remove everything including folders, subfolders and files in {retObj.path} located on plugin engine {api.ENGINE_URL}?')
if not confirm:
return
confirm = await api.confirm(f'Are you really sure you want to remove EVERYTHING inside?')
if confirm:
shutil.rmtree(retObj.path)
api.alert('All Files and folders removed.')
api.export(ImJoyPlugin())
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment