Editorial Workflows

Workflow Backup...

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: Saves or restores a backup of all Editorial workflows in Dropbox (this requires the Dropbox account to be linked).

Shared by: @olemoritz

Comments: Comment Feed (RSS)

anonymous — 29 May 2014
Could this save to a …/Backups folder?
@olemoritz — 30 May 2014
Theoretically yes, but that would require that the Backups folder already exists, and it's currently not possible to create new Dropbox folders programmatically.
@dahanbn — 03 Aug 2015
As it seems it doesn't back the templates as well? Could it be possible that templates also will be backed up and can be restored in a future version?
Stefan Wolfrum — 30 May 2016
Unfortunately, this workflow won't import the backup I made two months ago. 😒
The backup ZIP file resides in /Apps/Editorial/ and it isn't greyed out anymore because I tapped (and therefore downloaded) it.
However, the Restore part of the workflow can't find it ("No Backups Found"). 😒
Anything I can do about it, Ole?
Stefan Wolfrum — 30 May 2016
UH! OH!
My bad! I have an *EDITORIAL* backup file – not a *WORKFLOWS* backup file!
So please ignore my last comment. 😳
Johnf307 — 09 Apr
Hello! Someone in my Facebook group shared this website with us so I came to check it out. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Outstanding blog and superb design and style. ekdbaddbdgee
Pharmc289 — 09 Apr
doser — 11 Apr
Lot glands my clomid for sale online my excellent - if i doser viagra does it work prescription on line summer.
price — 11 Apr
Generic cheapest price generic cialis canadian, cialis dosages available is there a generic for cialis .
someone — 11 Apr
cialis — 19 Apr
american_cialis — 19 Apr
day — 20 Apr
buy_cialis — 20 Apr
I loved your post.Much thanks again.
buy_cialis — 20 Apr
Hello!
buy cialis ,
cheap_viagra — 23 Apr
Do you have a spam problem on this site I also am
cheap_cialis — 26 Apr
Pharmk546 — 27 Apr
Hello! decekef interesting decekef site! I'm really like it! Very, very decekef good!
Pharmk226 — 27 Apr
Very nice site! [url=http://ypxoiea.com/qyvosq/2.html]cheap cialis[/url]
Pharme759 — 27 Apr
Very nice site! [url=http://ypxoiea.com/qyvosq/50/a1a.html]cheap cialis[/url] , [url=http://ypxoiea.com/qyvosq/50/a2a.html]cheap cialis[/url] , [url=http://ypxoiea.com/qyvosq/50/a3a.html]cheap cialis[/url] , [url=http://ypxoiea.com/qyvosq/50/a4a.html]cheap cialis[/url] , [url=http://ypxoiea.com/qyvosq/50/a5a.html]cheap cialis[/url] ,
Michael — 29 Apr
I do accept as true with all of the concepts you have offered in your post. They're really convincing and will definitely work. Still, the posts are very brief for beginners. May you please extend them a little from next time? Thanks for the post.
cialis — 21 May
Hello, Neat post. There's a problem with your web site in web explorer, may test thisK IE still is the market leader and a large component to people will leave out your magnificent writing due to this problem.
buy — 21 May
Hello, Neat post. There's a problem with your web site in web explorer, may test thisK IE still is the market leader and a large component to people will leave out your magnificent writing due to this problem.
cialis — 21 May
Hello, Neat post. There's a problem with your web site in web explorer, may test thisK IE still is the market leader and a large component to people will leave out your magnificent writing due to this problem.
cialis — 21 May
loans| — 26 May
cialis — 26 May
Hello!
cialis ,
cialis_cheap — 28 May
Hello!
cialis cheap ,
cialis|generic — 30 May
canadian — 07 Jun
viagra — 15 Jun
order_cialis — 17 Jun
payday_loans — 28 Jun
viagra — 28 Jun
viagra_online — 15 Jul

+ Add Comment

Workflow Preview
Show Alert ?
Title
Create or Restore?
Message
The backup of your workflows will be created as a zip file in your Dropbox (Workflows_Year: 2001_Month: 01_Day: 01-Hour: 01 (24h)_Minute: 01.zip).
Button 1
Create Backup
Output Value
backup
Button 2
Restore...
Output Value
restore
Button 3
(don't show)
Output Value
Show Cancel Button
ON
Set Variable ?
Variable Name
Action
Value
Input
If "Backup" was selected... ?
Run the block if
Action
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
backup
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 = '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
Backup Created
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If
If "Restore" was selected.... ?
Run the block if
Action
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
restore
List Backups (Python) ?
Source Code
#coding: utf-8
import workflow
import editor
import os
import re

wf_path = editor.get_workflows_path()
db_path = os.path.join(os.path.split(wf_path)[0], 'Dropbox')

backups = []
files = os.listdir(db_path)
for filename in files:
	if re.match('Workflows_.*\\.zip$', filename):
		backups.append(filename)
workflow.set_output('\n'.join(backups))
Stop if no backups are found... ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show Alert ?
Title
No Backups Found
Message
No backup files were found. You might need to download them first, if you see grayed-out backup files in your Dropbox folder.
Button 1
OK
Output Value
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Select from List ?
Title
Select a Backup
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
OFF
Show Warning Alert ?
Title
Warning
Message
This will replace all your workflows with the ones that are stored in the selected backup (Input).
Button 1
Continue
Output Value
Input
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
Restore the Backup (Python) ?
Source Code
#coding: utf-8
import workflow
import editor
from os import path
from zipfile import ZipFile

backup_filename = workflow.get_input()
db_path = path.join(path.split(editor.get_workflows_path())[0], 'Dropbox')
backup_path = path.join(db_path, backup_filename)

with ZipFile(backup_path, 'r') as z:
	z.extractall(editor.get_workflows_path())

editor.reload_workflows()
Show HUD ?
HUD Text
Backup Restored
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If