Editorial Workflows

Back Ups

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: This is a mash up of Mister Moritz's two workflows (Workflow Backup & Snippet Backup). This one does not have the option to restore though, it just backs up both your snippets and your workflows into a folder called Backups* within your Dropbox. I run this inside of my Workflow Palette to easily back up both snippets and workflows. Enjoy!

*Note: You must create this folder manually before you run this workflow.

Shared by: Minnepicker (Dan)

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Workflows ?
Run the block if
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Create the Backup (Python) ?
Source Code
#coding: utf-8
import workflow
import editor
import os
from zipfile import ZipFile
import datetime
from io import BytesIO

t = datetime.datetime.today()
backup_filename = 'Journal/Workflow Backups/Workflows_' + t.strftime('%Y_%m_%d-%H_%M') + '.zip'
wf_path = editor.get_workflows_path()
files = os.listdir(wf_path)
zip_buffer = BytesIO()
with ZipFile(zip_buffer, 'w') as z:
	for filename in files:
		name, extension = os.path.splitext(filename)
		if extension in ('.wkflw', '.edcmd'):
			z.write(filename)
	
zip_data = zip_buffer.getvalue()
editor.set_file_contents(backup_filename, zip_data, 'dropbox')
Show HUD ?
HUD Text
Workflows Backed Up
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If
Snippets ?
Run the block if
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Create the Backup (Python) ?
Source Code
#coding: utf-8
import workflow
import editor
import os
from zipfile import ZipFile
import datetime
from io import BytesIO

t = datetime.datetime.today()
backup_filename = 'Journal/Workflow Backups/Snippets_' + t.strftime('%Y_%m_%d-%H_%M') + '.zip'
wf_path = os.path.expanduser('~/Library/Application Support/Snippets')
files = os.listdir(wf_path)
zip_buffer = BytesIO()
with ZipFile(zip_buffer, 'w') as z:
	for filename in files:
		name, extension = os.path.splitext(filename)
		if extension in ('.snpt', '.edcmd'):
			z.write(os.path.join(wf_path, filename), filename)
	
zip_data = zip_buffer.getvalue()
editor.set_file_contents(backup_filename, zip_data, 'dropbox')
Show HUD ?
HUD Text
Snippets Backed Up
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If