Editorial Workflows

List Folder

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: Shows a popover with a list of files in a configurable folder.

Shared by: @olemoritz

Comments: Comment Feed (RSS)

Marquito — 13 Dec 2014
The workflow does not work, unfortunately!
It says a certain folder does not exist. Maybe it can be fixed. Thank you.
Marquito — 13 Dec 2014
I am sorry, I was giving up to quickly. I thought Folder and Location were variables available by default but now I set them manually.

+ Add Comment

Workflow Preview
Options ?
Set Variable ?
Variable Name
Files
Value
(This will be set by the following script action)
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import os

folder_name = workflow.get_variable('Folder')
folder_name = folder_name.strip('/')

in_dropbox = workflow.get_variable('Location') == '1'
if in_dropbox:
	root = os.path.expanduser('~/Library/Application Support/Dropbox')
else:
	root = os.path.expanduser('~/Documents')
full_dir_path = os.path.join(root, folder_name)

filtered_files = []
files = os.listdir(full_dir_path)
for f in files:
	if f.startswith('.'):
		continue
	full_path = os.path.join(full_dir_path, f)
	if os.path.isdir(full_path):
		continue
	filtered_files.append(f)
workflow.set_variable('Files', '\n'.join(filtered_files))
Custom UI ?
User Interface
Presentation Style
  • Sheet
  • Full-Screen
  • Popover
Output
Use Editor Theme
ON
Run Python Script ?
Source Code
import os
import workflow
import urllib

action_in = workflow.get_input()
folder_name = workflow.get_variable('Folder')
folder_name = urllib.quote(folder_name.encode('utf-8').strip('/'))

in_dropbox = workflow.get_variable('Location') == '1'
url = 'editorial://open/%s/%s?root=%s' % (folder_name, urllib.quote(action_in, ''), 'dropbox' if in_dropbox else 'local')
import webbrowser
webbrowser.open(url)