Jump to content

Do workflow data folders have to be created manually?


Recommended Posts

Posted

I'm working on a workflow and I'd like to write some output to a folder to store the text results as a file. I'm using the write text file object using a relative path of {var:input}.txt with the relative path setting of write to workflow's data folder (local, not exported). I'm surprised to encounter an error

 

Unable to write file '/Users/cwille97/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.cwille97.app/file.txt' as parent folder does not exist

when performing this operation. Is it necessary for me to manually create the data folder? What about when sharing the workflow with others, will they also have to manually create the folder as part of initial setup? I suppose I could script to check for the existence of a data folder on initial setup, and if it doesn't exist, create it. I don't want the actual data to persist when exporting the workflow, but it'd be nice to not have to set up that folder manually. I could also probably use the workflow cache folder for the same purpose, but that yields the same error.

Posted

The cache folder is the best way to go for data which is fleeting and the data folder for more persistent data.
 

Yes, you have to create the folders, the variables just point to paths. However, Write File has a checkbox to guarantee those exist. There are also Automation Tasks to create folders and they can take the variables. You don’t have to check if the directories exist, just create them anyway which won’t  mask me a difference when they exist.

Posted
29 minutes ago, vitor said:

The cache folder is the best way to go for data which is fleeting and the data folder for more persistent data.
 

Yes, you have to create the folders, the variables just point to paths. However, Write File has a checkbox to guarantee those exist. There are also Automation Tasks to create folders and they can take the variables. You don’t have to check if the directories exist, just create them anyway which won’t  mask me a difference when they exist.

It looks like the Write File checkbox is all that's needed to create the folder for me, it considers the destination folder to be an intermediate folder I suppose.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...